akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

string S;

int ans;

int cnt;



signed main()
{
    cin >> S;

    string T ="ATCG";

    for(int i=0;i<S.size();i++)
    {
        int now =0;
        for(int j=i;j<S.size();j++)
        {
            bool ok = false;



            for(int k=0;k<T.size();k++)
            {
                if(S[j]==T[k])ok = true;
            }

            if(ok)
            {
               now++;
               ans = max(ans,now);
            }
            else break;
        }
        
    }

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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


      


           
            int n = int.Parse(Console.ReadLine());
            int num = (int)Math.Pow(2,n);
            var stone = new int[num];
            for(int i=0; i<num; i++)
            {
                stone[i] = int.Parse(Console.ReadLine());
            }

            var cp = new List<int>(stone);
            
            var ans = new List<int>();
            while(true)
            {
                ans = new List<int>();
                for(int i=0; i<cp.Count(); i+=2)
                {
                    if (i == cp.Count() - 1) ans.Add(cp[i]);
                    else ans.Add(calc(cp[i], cp[i+1]));
                }
                cp = new List<int>(ans);

                if (ans.Count() == 1) break;
            }


            Console.WriteLine(ans[0]);



        }

		public static int calc(int a, int b)
        {
            if (a == b) return a;
            else if (a > b) return a - b;
            else return b - a;
        }
        

    }


   

    
}


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

long long n, ans, c[150];
string a;
int main()
{
	int i;
	cin >> a;
	n = a.size();
	for (i = 0; i < n; i++) c[a[i]]++;
	ans = n * (n - 1) / 2 + 1;
	for (i = 'a'; i <= 'z'; i++) ans -= c[i] * (c[i] - 1) / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 764
def main():
    S = input()
    cur = [[int(S[0]), S[0]]]
    for i in range(1, len(S)):
        temp = []
        for v, s in cur:
            temp.append([v+int(S[i]), s+"+"+S[i]])
            temp.append([v-int(S[i]), s+"-"+S[i]])
        cur = temp
    for v, s in cur:
        if v == 7:
            return s + "=7"

if __name__ == '__main__':
    print(main())

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

using namespace std;

const int MAX = 100005;

int N;
int A[MAX];


int main(int argc, char* argv[]) {
    cin >> N;

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

        A[i] = A[i] - 1;
    }

    int n = 0;

    for (int i = 0; i < N; ++i) {
        if (A[A[i]] == i) {
            n++;
        }
    }

    n = n / 2;

    cout << n << endl;

    return 0;
}


Measured memory_bytes: 640
import kotlin.math.min

fun main() {
    val (n, x, m) = nextLongList()
    var a = x
    var loopSum = a
    val loopSet = linkedSetOf(a)
    var loopIndex = 0
    var i = 1
    while (i < m) {
        a = a.times(a).rem(m)
        if (a in loopSet) {
            loopIndex = loopSet.indexOf(a)
            break
        }
        loopSum += a
        loopSet.add(a)
        i++
    }
    var sum = 0L
    val loopList = loopSet.toList()
    repeat(min(n, loopIndex.toLong()).toInt()){
        loopList.toList()
        sum += loopList[it]
    }
    n.minus(loopIndex).takeIf { it > 0 }?.let {
        val loop = it / (loopList.size - loopIndex)
        sum += loopSum.minus(sum).times(loop)
        repeat(it.rem((loopList.size - loopIndex)).toInt()) {index ->
            sum += loopList[loopIndex + index]
        }
    }
    println(sum)
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

Measured memory_bytes: 46704
import sys
sys.setrecursionlimit(200200)

mod = 10 ** 9 + 7

N, *AB = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
    E[a - 1].append((b - 1, i))
    E[b - 1].append((a - 1, i))

X = [0] * N

def dfs(u, i):
    res = 1
    for v, c in E[u]:
        if i != c:
            res += dfs(v, c)
    X[i] = res
    return res

dfs(0, -1)

I = [1] * (N + 1)
inv = pow(2, mod - 2, mod)
for i in range(N):
    I[i + 1] = I[i] * inv % mod

ans = (I[N] + 1) * (N - 1) - inv * N - I[N] + 1
for e in range(N - 1):
    ans -= I[X[e]] + I[N - X[e]]
    ans %= mod

print(ans)

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

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

int main() {
  int a, b, x;
  std::cin >> a >> b >> x;

  if (2*x > a*a*b) {
    cout << std::setprecision(8) << 180.0/M_PI * atan( 2.0*(a*a*b - x)/(a*a*a) ) << endl;
  } else {
    cout << std::setprecision(8) << 180.0/M_PI * atan( a*b*b/(2.0*x) ) << endl;
  }
}


Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }

    if (y == 0) {
        if (x >= 0) {
            println(1 + x)
        } else {
            println(Math.abs(x))
        }
    } else if (x >= 0 && y >= 0) {
        if (x <= y) {
            println(y - x)
        } else {
            println(2 + x - y)
        }
    } else if (x >= 0 && y < 0) {
        if (Math.abs(y) >= x) {
            println(1 + Math.abs(y) - x)
        } else {
            println(x-Math.abs(y) + 1)
        }
    } else if (x < 0 && y > 0) {
        if (Math.abs(x) <= y) {
            println(1 + y - Math.abs(x))
        } else {
            println(Math.abs(x)-y + 1)
        }
    } else {
        if (x <= y) {
            println(Math.abs(x) - Math.abs(y))
        } else {
            println(Math.abs(y) - Math.abs(x) + 2)
        }
    }
}

Measured memory_bytes: 37872
import math

while 1 :
    a, op, b = raw_input().split()
    a, b = map(int, [a, b])

    if op == "+" :
        print a + b
    elif op == "-" :
        print a - b
    elif op == "*" :
        print a * b
    elif op == "/" :
        print a / b
    else :
        break

Measured memory_bytes: 6460
from collections import defaultdict
n = int(input())
G = defaultdict(list)
rec = []
for i in range(n):
    a, b = map(int, input().split())
    rec.append((i, a, b))


for i in range(n):
    c, d = map(int, input().split())
    for index, p, q in rec:
        if p < c and q < d:
            G[index].append(i + n)
            G[i + n].append(index)


used = [False] * 2 * n
match = [-1] * 2 * n


def dfs(v):
    global used
    used[v] = True
    for u in G[v]:
        w = match[u]
        if w < 0 or not used[w] and dfs(w):
            match[v] = u
            match[u] = v
            return True


ma = 0
for i in range(n):
    if match[i] < 0:
        used = [False] * 2 * n
        if dfs(i):
            ma += 1

print(ma)

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

int gcd3(int a, int b, int c){

    int tmp, r;

     /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

//2
  if(b<c){
    tmp = b;
    b = c;
    c = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = b % c;
  while(r!=0){
    b = c;
    c = r;
    r = b % c;
  }

  return c;

}

int gcd2(int a, int b){

    int tmp, r;
     /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  return b;

}

int main(void){
  int K;

int count=0;

scanf("%d", &K);

int ttp = K;

while(ttp!=0){
   count += ttp;
   ttp -=1;
}

int i, j, m;

for(i=1; i<K; i++){
    for(j=i+1; j<=K; j++){
        if(i != j){
 count += 6*gcd2(i, j);
        }
        for(m=j+1; m<=K; m++){
            if(i!=j && j!=m && m!=i){
                count += 6*gcd3(i, j, m);
            }
        }
    }
}

  printf("%d\n", count);
  return 0;
}



Measured memory_bytes: 1732
fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map { it.toLong() }
    when {
        x == 1L || y == 1L -> 1
        x * y % 2 == 1L -> x * y / 2 + 1L
        else -> x * y / 2
    }.let { println(it) }
}


Measured memory_bytes: 37992
D, G = map(int, input().split())
P = [tuple(map(int, input().split())) for _ in range(D)]
ans = float('inf')
for bit in range(1 << D):
    score = 0
    count = 0
    rest = -1
    for i, pc in enumerate(P):
        p, c = pc
        if bit >> i & 1:
            score += 100 * (i + 1) * p + c
            count += p
        else:
            rest = i
    if score < G:
        s1 = 100 * (rest + 1)
        need = (G - score + s1 - 1) // s1
        if need >= P[rest][0]:
            continue
        count += need
    ans = min(ans, count)
print(ans)


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 5001;

int N, ans;
string S;
int dp[MX][MX];

void solve() {
    cin >> N >> S;
    
    for (int i = 1; i <= N; i++) {
		for (int j = i + 1; j <= N; j++) {
			if (S[i - 1] == S[j - 1] && dp[i-1][j-1] < (j - i)) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				
				chmax(ans, dp[i][j]);
			}
		}
	}
	cout << ans;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 96896
#include <stdio.h>

int main()
{
	double L,a,b,c,V;
	
	scanf("%lf",&L);
	a = L/3;
	b = L/3;
	c = L - a - b;

	V = a*b*c;
	printf("%lf\n",V);
	return 0;
}

Measured memory_bytes: 128
N, A, B = map(int, input().split())

alice = A 
bolice = B
while True:
    if alice + 1 != N + 1 and alice + 1 != bolice:
        alice += 1
    else:
        res = 'Borys'
        break

    if bolice - 1 != 0 and  bolice - 1 != alice:
        bolice -= 1
    else:
        res = 'Alice'
        break

print(res)



Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,a,b,flag=0;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			flag=1;
			cout<<"OK"<<endl;
			break;
		}
	}
	if(flag==0) cout<<"NG"<<endl;
	return 0;
}

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

#define P pair<int,int>
P V[100000];
signed main(){
int n;cin>>n;
for(int i=0;i<n;i++){
cin>>V[i].first>>V[i].second;
}
sort(V,V+n,greater<P>());
cout<<V[0].first+V[0].second<<endl;
}

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

#define int long long int
#define main signed main()
#define bye return 0

#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define sum(v) accumulate(all(v), 0)
#define cinv(v, n) rep(i, n) cin >> v[i]
#define prec(n) fixed << setprecision(n)
#define stlice(s, l) substr(s, s + l + 1)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))

#define INF 1e9
#define MOD (1e9 + 7)

#define pb push_back
#define mt make_tuple
#define fi first
#define se second
#define str string
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<str>

using namespace std;

int f(int x, int y) { return x <= y ? y - x : x - y + 2; }

main {
  int x, y;
  cin >> x >> y;
  cout << min({f(x, y), f(-x, y) + 1, f(x, -y) + 1, f(-x, -y) + 2}) << endl;
  bye;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 100;

int aa[N];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++)
		cin >> aa[i];
	sort(aa, aa + n);
	int ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			for (int k = j + 1; k < n; k++)
				if (aa[i] != aa[j] && aa[i] != aa[k] && aa[j] != aa[k] && aa[i] + aa[j] > aa[k])
					ans++;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

long long Pmax(long long T)
{
	for (long long i = 2; i * i <= T; i++)
	{
		while (T % i == 0)
		{
			T /= i;
		}
	}
	return T;
}

void P(long long T, vector<long long>&p)
{
	p.clear();
	for (long long i = 2; i * i <= T; i++)
	{
		while (T % i == 0)
		{
			p.push_back(i);
			T /= i;
		}
	}
	if (T != 1)p.push_back(T);
}

int main() {
	long long S;cin>>S;



	vector<long long>prime;

	long long cnt = 1;
	while (1)
	{
		long long a1 = 1, a2 = 1, b1 = 1, b2 = 1;
	long long T = min<long long>(1e18, S + cnt * 1e8);
	cnt++;
	T = 1e8 * (long long)(T/1e8);

	P(T, prime);
	for (int i = (int)prime.size() - 1; i >= 0; i--)
	{
		if (a1 > b2)
		{
			b2 *= prime[i];
		}
		else
		{
			a1 *= prime[i];
		}
	}
	if(a1>1e9||b2>1e9)continue;

	//cerr<<T<<" "<<S<<endl;
	prime.clear();
	P(T-S, prime);
	
	for (int i = (int)prime.size() - 1; i >= 0; i--)
	{
		if (a2 > b1)
		{
			b1 *= prime[i];
		}
		else
		{
			a2 *= prime[i];
		}
	}
	if (a2 > 1e9 || b2 > 1e9)continue;


	//cerr<<abs(a1*b2-a2*b1)<<endl;
	cout<<0<<" "<<0<<" "<<a1<<" "<<a2<<" "<<b1<<" "<<b2<<endl;
	break;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
string s;
double vx,px,py,pi;
int n,k,l;
string hack(int n){
	if(n==0)return "";
	return hack(n-1)+"1"+hack(n-1)+"4"+hack(n-1)+"1"+hack(n-1);
}
int main(){
	cin>>n;
	pi=acos(-1);
	vx=100.0/pow(3.0,n);
	s=hack(n);
	l=s.length();
	printf("%.6f %.6f\n",px,py);
	for(int i=0;i<l;i++){
		px+=cos(k*pi/3.0)*vx;
		py+=sin(k*pi/3.0)*vx;
		printf("%.6f %.6f\n",px,py);
		k+=s[i];
	}
	px+=cos(k*pi/3.0)*vx;
	printf("%.6f %.6f\n",px,py);
}


Measured memory_bytes: 3684
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int A[1000000], n;

int main()
{
    cin >> n;
    for ( int i = 0; i < n; i++){
        scanf("%d", &A[i]);
        
    }
    int q, k, sum = 0;
    cin >> q;
    for ( int i = 0; i < q; i++) {
        cin >> k;
        if ( *lower_bound(A, A + n, k) == k) sum++;
    }
    cout << sum << endl;
    return 0;
    
}

Measured memory_bytes: 1632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(n*a,b) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

using namespace std;
using LLint = long long int;

const int mod = 1000000007;
int main(){
	int N,H;
	cin>>H>>N;
	int count=0;
	for(int i=0;i<N;++i)
	{
		int A;
		cin>>A;
		count+=A;
	}
	if(H-count<=0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}


Measured memory_bytes: 256
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	int d, n;
	cin >> d >> n;
	int suffix = pow(10, 2 * d);
	cout << (n <= 99 ? n * suffix : suffix * 101) << '\n';
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define lld long double
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;
	cin>>n;

	map<lli,lli> cnt;
	REP(i,0,n){
		lli a;
		cin>>a;
		cnt[-a]++;
	}

	lli d[2]={0};
	lli now=0;
	for(auto e:cnt){
		if(e.second>=2){
			e.second-=2;
			d[now] = e.first;
			now++;
		}
		if(now>=2)break;
		if(e.second>=2){
			e.second-=2;
			d[now] = e.first;
			now++;
		}
		if(now>=2)break;
	}
	cout<<d[0]*d[1]<<endl;

	return 0;
}

Measured memory_bytes: 6528
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;

const string yey = "Yay!";
const string sad = ":(";

void solve() {
	int n; cin >> n;
	vector<ll> x(n), y(n);
	vector<LP> v(n);
	rep(i, n) {
		cin >> x[i] >> y[i];
		v[i] = { x[i],y[i] };
	}
	sort(v.begin(), v.end());
	rep(i, n) {
		x[i] = v[i].first, y[i] = v[i].second;
	}
	map<LP, bool> mp;
	rep(i, n) {
		mp[v[i]] = true;
	}
	int ans = n;
	rep(i, n) {
		rep(j, n) {
			if (i == j)continue;
			ll p = x[j] - x[i], q = y[j] - y[i];
			vector<bool> used(n, false);
			int cnt = 0;
			rep(k, n) {
				cnt++;
				if (mp[{x[k] - p, y[k] - q}])cnt--;
			}
			ans = min(ans, cnt);
		}
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(9);
	//init();
	//while (cin >> n>>m>>l,n)solve();
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
bool sortbysec(const pair<int,int> &a,
               const pair<int,int> &b)
{
    return (a.second < b.second);
}
int main()
{
    ll t=1,i,j,k=0,n,z,a,b,d,x,y,m;
    //cin>>t;
    while(t--)
    {
       cin>>n;
       vector<ll>v;
       for(i=0;i<n;i++)
       {
           cin>>k;
           v.push_back(k);
       }
       sort(v.begin(),v.end());
       ll cnt=0;
       for(i=0;i<n;i++)
       {
           for(j=i+1;j<n;j++)
           {
               for(k=j+1;k<n;k++)
               {
                   if(v[i]+v[j]>v[k]&&v[i]!=v[j]&&v[j]!=v[k]&&v[k]!=v[i])
                   {
                       cnt++;
                   }
               }
           }
       }
cout<<cnt<<endl;

    }
    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int W = sc.nextInt();

        if (W >= S) {
            System.out.println("unsafe");
        } else {
            System.out.println("safe");
        }
        sc.close();
    }
}

Measured memory_bytes: 35848
#include <bits/stdc++.h>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1; (i)>=(k); --(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define debug(x) cerr << #x <<": "<<(x)<<endl
#define debug2(x,y) cerr << #x <<": "<< (x) <<", "<< #y <<": "<< (y) << endl
#define answer(x) cout << (x) <<endl
#define answer_fixed(x, p) cout << fixed << setprecision(p) << (x) << endl
using namespace std;
//static const int INF = 1e9;
//static const double PI = acos(-1.0);
//static const double EPS = 1e-10;
//static const int dx[8] = { 1, 1, 0,-1,-1,-1, 0, 1};
//static const int dy[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
typedef long long int LL;
typedef unsigned long long int ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef pair<int, int> PII;

int main() {
  string S;
  cin >> S;
  vector<regex> Re(8);
  Re[0] = (".*keyence");
  Re[1] = ("k.*eyence");
  Re[2] = ("ke.*yence");
  Re[3] = ("key.*ence");
  Re[4] = ("keye.*nce");
  Re[5] = ("keyen.*ce");
  Re[6] = ("keyenc.*e");
  Re[7] = ("keyence.*");
  bool ans = false;
  for(auto r : Re) ans |= regex_match(S, r);
  cout << (ans ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
cards=[]
for i in ["S","H","C","D"]:
    for j in range(13):
        cards.append("{0} {1}".format(i,j+1))


n = int(input())
array=[]
for i in range(n):
    array.append(input())
#print(array[1~~~][1or0])

for j in range(n):
   cards.remove(array[j])

for l in range(len(cards)):
    print(cards[l])



Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string s;

int main(){
	cin >> s;
	s[3]='8';
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define F first
#define S second
using namespace std;
typedef long long ll;


int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && a == c) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#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 fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    int cneg = 0;
    bool ok = false;
    vector<int> a(n);
    vector<int> neg;
    rep(i,0,a.size()){
        cin>>a[i];
        if ( a[i] < 0 ){
            cneg++;
            neg.pb(-a[i]);
        }
        else{
            neg.pb(a[i]);
        }
        if ( a[i] == 0 ){
            ok = true;
        }
    }
    int ans = 0;
    if (ok){
        rep(i,0,a.size()){
            if ( a[i] < 0 ){
                ans += (-a[i]);
            }
            else{
                ans += a[i];
            }
        }
        cout<<ans<<endl;
    }
    else{
        if ( cneg&1 ){
            int x = *min_element(all(neg));
            rep(i,0,neg.size()){
                if ( x == neg[i] ){
                    ans -= x;
                }
                else{
                    ans += neg[i];
                }
            }
        }
        else{
            rep(i,0,a.size()){
                if ( a[i] < 0 ){
                    ans += (-a[i]);
                }
                else{
                    ans += a[i];
                }
            }
        }

        cout<<ans<<endl;
    }
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 5028
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
  int a;
  string s;

  while (cin >> a >> s) {
    for (int i = 0; i < s.size(); i++) {
      int ch = (s[i] - 'A');
      ch = (ch + a) % 26;
      s[i] = 'A' + ch;
    }
    cout << s << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
  unsigned long long n, sum;
  while(cin >> n, n){
    sum = -n;
  
    for(int i = 1 ; i * i <= n ; i++){
      //cout << "OK" << endl;
      if(n % i == 0){
	sum += i + n/i;
	if(i == n/i) sum -= i;
      }
    }
    
    if(sum == n) cout << "perfect number" << endl;
    else if(sum < n) cout << "deficient number" << endl;
    else if(sum > n) cout << "abundant number" << endl;
  }
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> L(N+1);
  L.at(0)=2;
  L.at(1)=1;
  for(int i=2; i<=N; i++){
    L.at(i)=L.at(i-1)+L.at(i-2);
  }
  cout << L.at(N) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
ll a[3000][3000],dp[3000][3000][4];
int main(){
  ll R,C,K,i,j,k,r,c,u;scanf("%lld%lld%lld",&R,&C,&K);
  for(i=0;i<K;i++){
    scanf("%lld%lld%lld",&r,&c,&u);r--;c--;
    a[r][c] = u;
  }
  dp[0][0][1] = a[0][0];
  for(j=1;j<C;j++){
    for(k=0;k<4;k++){
      dp[0][j][k] = dp[0][j-1][k];
      if(a[0][j] && k>0) dp[0][j][k] = max(dp[0][j][k],dp[0][j-1][k-1]+a[0][j]);
    }
  }
  for(i=1;i<R;i++){
    for(j=0;j<C;j++){
      dp[i][j][0] = *max_element(dp[i-1][j],dp[i-1][j]+4);
      if(a[i][j]) dp[i][j][1] = dp[i][j][0]+a[i][j];
      for(k=0;k<4;k++){
        if(j > 0) dp[i][j][k] = max(dp[i][j][k],dp[i][j-1][k]);
        if(a[i][j] && j>0 && k>0) dp[i][j][k] = max(dp[i][j][k],dp[i][j-1][k-1]+a[i][j]);
      }
    }
  }
  printf("%lld\n",*max_element(dp[R-1][C-1],dp[R-1][C-1]+4));
}

Measured memory_bytes: 355104
#!/usr/bin/env python3
mod = 10**9 + 7
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
ng = [False] * (10**5 + 1)
for x in a:
    ng[x] = True
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
    if i > 0 and not ng[i - 1]: dp[i] += dp[i - 1]
    if i > 1 and not ng[i - 2]: dp[i] += dp[i - 2]
    dp[i] %= mod
print(dp[n])


Measured memory_bytes: 9580
use std::cmp::max;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let cs: Vec<char> = s.chars().collect();
    let mut ans = 0;
    let mut count = 0;
    for i in cs.into_iter() {
        count = match i {
            'A' => count + 1,
            'C' => count + 1,
            'G' => count + 1,
            'T' => count + 1,
            _ => 0,
        };
        ans = max(ans, count);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
# include <bits/stdc++.h>
# define INF 1e9
using namespace std;

int main(){

  int N;
  cin >> N;
  long int a[N-1][3];
  for(int i=0; i<N-1;++i){
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }
  for(int i=0; i<N-1; ++i){
    long int t = 0;
    int j = i;
    while(j < N-1){
      if(a[j][1] >= t) t = a[j][1]+a[j][0];
      else {
        if((t-a[j][1]) % a[j][2] == 0) t += a[j][0];
        else t += a[j][2] - (t-a[j][1]) % a[j][2] + a[j][0];
      }
      j++;
    }
    cout << t << endl;
  }
  cout << 0 << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
constexpr long MOD = 1e9 + 7;

long modpow(long x, long e) {
  long res = 1;
  while(e) {
    if (e & 1) res = res * x % MOD;
    x = x * x % MOD;
    e >>= 1;
  }
  return res;
}

long modinv(long x) {
  return modpow(x, MOD - 2);
}

// ---- 
int n, a, b, size[200020];
vector<int> g[200020];
// ----

int rec1(int p, int v) {
  int res = 1;
  for(int nv: g[v]) {
    if(p == nv) continue;
    res += rec1(v, nv);
  }
  return size[v] = res;
}

long rec2(int p, int v) {
  long res = 0;
  for(int nv: g[v]) {
    if(p == nv) continue;
    res = (res + rec2(v, nv) + (1 - modinv(modpow(2, size[nv])) + MOD) % MOD * (1 - modinv(modpow(2, n - size[nv])) + MOD) % MOD) % MOD;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n;
  for(int i = 0; i < n - 1; ++i) {
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  rec1(-1, 0);
  long S_exp = rec2(-1, 0) + (modpow(2, n) - 1) * modinv(modpow(2, n)) % MOD;
  long black_exp = n * modinv(2) % MOD;
  cout << (S_exp - black_exp + MOD) % MOD;
  return 0;
}

Measured memory_bytes: 23168
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>

int main()
{
    int n;
    scanf("%d", &n);
    vector<ll> a(n), b(n), c(n),d(n);
    for(int i=0; i<n; i++){
        scanf("%lld",&a[i]);
    }
    for(int i=0; i<n; i++){
        scanf("%lld",&b[i]);
    }
    for(int i=0; i<n; i++){
        scanf("%lld",&c[i]);
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    ll ans = 0, tmp,cnt;
    for(int i=0; i<n; i++){
        d[i] = n - (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
    }
    for(int i=1; i<n; i++){
        d[i] = d[i] + d[i-1];
    }
    for(int i=0; i<n; i++){
        tmp =  upper_bound(b.begin(), b.end(), a[i]) - b.begin();
        if(tmp==0){
            ans+=d[n-1];
        }
        else{
            ans+=(d[n-1] - d[tmp-1]);
        }
    }
    printf("%lld\n",ans);
    return 0;
}



Measured memory_bytes: 3964
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    ll n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;
    ll div_num = min({a, b, c, d, e});
    ll time = (n + div_num - 1 ) / div_num;
    cout << 4LL + time << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <atcoder/math>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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









int main(){
    int T; std::cin >> T;
    {
        int N, M, A, B;
        for(int i(0); i < T; ++i){
            std::cin >> N >> M >> A >> B;
            std::cout << atcoder::floor_sum(N, M, A, B) << "\n";
        }
    }
    return 0;
}


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

int main()
{
    int i,n,value,a;

    cin>>n;
    set<int>st;

    for(i=0;i<n;i++)
    {
        cin>>a;
    if(a==0)
    {
        cin>>value;
        st.insert(value);
        cout<<st.size()<<"\n";
    }
    if(a==1)
    {
        cin>>value;
        int result = st.find(value)!=st.end();
        cout<<result<<"\n";
    }
    if(a==2)
    {
        cin>>value;
        st.erase(value);


    }

}
}



Measured memory_bytes: 12456
using System;
using System.Collections.Generic;

namespace agc034_a
{
  class Program
  {
    static void Main(string[] args)
    {
      var n = CIn.ReadInt();
      var a = CIn.ReadInt();
      var b = CIn.ReadInt();
      var c = CIn.ReadInt();
      var d = CIn.ReadInt();
      var s = CIn.Read().ToCharArray();

      var sum2x = new int[n + 1];
      var sum3o = new int[n + 1];

      for (var i = 2; i <= n; i++)
      {
        sum2x[i] = sum2x[i - 1];
        sum3o[i] = sum3o[i - 1];
        if (s[i - 2] == '#' && s[i - 1] == '#') sum2x[i]++;
        if (i > 2 && s[i - 3] == '.' && s[i - 2] == '.' && s[i - 1] == '.') sum3o[i]++;
      }

      if (sum2x[c] - sum2x[a + 1] > 0 || sum2x[d] - sum2x[b + 1] > 0)
      {
        Console.WriteLine("No");
        return;
      }

      if (c > d && sum3o[d + 1] - sum3o[b] == 0)
      {
        Console.WriteLine("No");
        return;
      }

      Console.WriteLine("Yes");
    }
  }


  class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }

      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(long n)
    {
      var array = new string[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }

      return array;
    }

    public static int[] ReadIntArray(long n)
    {
      var array = new int[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }

      return array;
    }

    public static long[] ReadLongArray(long n)
    {
      var array = new long[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }

      return array;
    }
    public static double[] ReadDoubleArray(long n)
    {
      var array = new double[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }

      return array;
    }
  }
}

Measured memory_bytes: 14432
#include <stdio.h>

int main(void)
{
  	char a,b,str[16];
	int c,d;
  
	fgets(str,sizeof(str),stdin);
	sscanf(str,"%c %c",&a,&b);
	
	if(a == 'H')
	{
		c = 1;
	}
	else
	{
		c = 0;
	}
	if(b == 'H')
	{
		d = 1;
	}
	else
	{
		d = 0;
	}
	
	if((c+d)%2 == 0)
	{
		puts("H");
	}
	else
	{
		puts("D");
	}
	return 0;
}

Measured memory_bytes: 128
q,h,s,d = map(int,input().split())
n = int(input())

ans = 0
#2Lの一番良い買い方をする
if n>=2:
    amount = n//2
    n-=amount*2
    ans+=min(q*8,h*4,s*2,d*1)*amount
if n==1:
    ans+=min(q*4,h*2,s*1)
print(ans)

Measured memory_bytes: 3060
// id: ALDS1_4_B
#include <stdio.h>
#include <stdlib.h>

int bin_search(int a[], int n, int key);

int main(void)
{
	int n, q;
	int *s, *t;
	int cnt = 0;

	scanf("%d", &n);
	s = malloc(sizeof(int) * n);
	for ( int i = 0; i < n; ++i )
		scanf("%d", &s[i]);

	scanf("%d", &q);
	t = malloc(sizeof(int) * q);
	for ( int i = 0; i < q; ++i )
		scanf("%d", &t[i]);

	for ( int i = 0; i < q; ++i ) {
		if ( bin_search(s, n, t[i]) != -1 )
			++cnt;
	}

	printf("%d\n", cnt);

	free(s);
	free(t);

	return 0;
}

int bin_search(int a[], int n, int key)
{
	int left = 0, right = n - 1;
	int res = -1;

	while ( left <= right ) {
		int mid = (left + right) / 2;

		if ( a[mid] > key )
			right = mid - 1;
		else if ( a[mid] < key )
			left = mid + 1;
		else {
			res = mid;
			break;
		}
	}

	return res;
}


Measured memory_bytes: 2056
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
using namespace std;

#define INF 1e18
#define int long long

template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    int n, w; cin >> n >> w;
    vector<int> weight(n), value(n);
    for(int i = 0; i < n; i++) cin >> weight[i] >> value[i];

    vector<vector<int>> dp(n + 1, vector<int> (w + 1, 0));

    for(int i = 0; i < n; i++) {
        for(int j = 0; j <= w; j++) {
            if(j - weight[i] >= 0) {
                chmax(dp[i + 1][j], dp[i][j - weight[i]] + value[i]);
            }
            chmax(dp[i + 1][j], dp[i][j]);
        }
    }

    cout << dp[n][w] << endl;
    return 0;
}


Measured memory_bytes: 80256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;


string s;
int sum=0;


int main()
{
	cin>>s;
	int len=s.length();
	for(int i=0;i<=len-1;i++)
	{if((i+1)%2==0)
		{
		  if((s[i]!='L')&&(s[i]!='U')&&(s[i]!='D')) sum++;}
		if((i+1)%2==1)
		{
		if((s[i]!='R')&&(s[i]!='U')&&(s[i]!='D'))sum++;}
	}
	if(sum==0) cout<<"Yes";
	if(sum!=0) cout<<"No";
}

Measured memory_bytes: 256
N=int(input())
alist=list(map(int,input().split()))

answer=0
loop_flg=True
while(loop_flg):
  for i in range(N):
    if alist[i]%2==0:
      alist[i]//=2
    else:
      loop_flg=False
      break
  else:
    answer+=1
    
print(answer)

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

using namespace std;

int main()
{
   int A,B,C,D;
   scanf("%d %d %d %d",&A,&B,&C,&D);
   if((A+B)==(C+D)) printf("Balanced\n");
   else if((A+B)>(C+D)) printf("Left\n");
   else if((A+B)<(C+D)) printf("Right\n");
   return 0;
}


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

typedef long long ll;

int N;
ll A,B,K;
ll mod = 998244353;
ll F[300010] = {1};
ll R[300010] = {1};
ll ans;

ll pow_mod(ll a,ll b)
{
    if(b == 0)return 1;
    ll res = pow_mod(a * a % mod,b / 2);
    if(b & 1)res = res * a % mod;
    return res;
}

ll con(int a,int b)
{
    return F[a] * R[b] % mod * R[a - b] % mod;
}

int main()
{
    scanf("%d",&N);
    scanf("%lld%lld%lld",&A,&B,&K);

    for(int i = 1; i <= N; i++)F[i] = F[i - 1] * i % mod;
    for(int i = 0; i <= N; i++)R[i] = pow_mod(F[i],mod - 2);

    for(int i = 0; i <= N; i++)
    {
        ll rest = K - A * i;
        if(rest >= 0 && rest % B == 0 && rest / B <= N)
        {
            ans += con(N,i) * con(N,rest / B) % mod;
            ans %= mod;
        }
    }

    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 4864
fun main(args: Array<String>) {

    val N = readLine()!!.toInt()
    val S = readLine()!!

    var ans = 0
    for(i in 0 until N - 2){
        if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++
    }

    println(ans)
}

Measured memory_bytes: 33732
#include<iostream>
using namespace std;
int main() {
	int a[3], masatoy = 0;
	char str[1000][1000];
	bool temp = true;
	cin >> a[0] >> a[1] >> a[2];
	for (int i = 0; i<a[0]; i++) {
		cin >> str[i];
	}
	for (int i = 0; i < a[0]; i++) {
		for (int j = 0; j < a[1]; j++) {
			if (str[i][j] == '.') {
				for (int x = 0; x<a[2]; x++) {
					if (str[i + x][j] != '.'&&temp == true) {
						temp = false;
					}
					if (x == a[2] - 1 && temp == true)masatoy++;
				}
			}
			temp = true;
		ruio:;
			if (str[i][j] == '.') {
				for (int x = 0; x < a[2]; x++) {
					if (str[i][j + x] != '.'&&temp == true) {
						temp = false;
					}
					if (x == a[2] - 1 && temp == true)masatoy++;
				}
			}
			temp = true;
		hideo:;
		}
	}
	cout << masatoy << endl;
}

Measured memory_bytes: 3220
import scala.io.{StdIn => in}

object Main extends App {
  val out = new java.io.PrintWriter(System.out)
  val Array(r, d, x) = in.readLine.split(" ").map(_.toLong)
  var xi = x
  (1 to 10).foreach { i =>
    val v = r * xi - d
    out.println(v)
    xi = v 
  }
  out.flush
}

Measured memory_bytes: 25524
def judge(string):
    cw = False
    judge = False
    for i in range(2, len(string) - 1):
        if string[i].isupper() and string[i] != 'C':
            judge = True
        elif string[i].isupper() and string[i] == 'C' and cw:
            judge = True
        
        if string[i] == 'C':
            cw = True

    if judge or cw == False:
        return True
    else:
        return False        
    
if __name__ == "__main__":
    s = list(input().strip())
    if s[0] != "A" or s[1].isupper() or s[-1].isupper() or judge(s):
        print('WA')
    else:
        print('AC')
    

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

using namespace std;

typedef long long ll;
const ll M = 1000000007;

ll pow(ll x, int y){
    if(y == 0) return 1;
    for(int i=0;i<y-1;i++){
        x *= 2;
        x %= M;
    }
    return x;
}

int main()
{
    int N, c;
    bool flag = true;
    cin >> N;
    vector<int> human(N/2);
    for(int i=0;i<N;++i){
        cin >> c;
        if(c == 0) continue;
        if(N == 1 && c != 0){
            flag = false;
            break;
        }
        ++human[(c-1)/2];
    }

    for(int h : human){
        if(h != 2){
            flag = false;
            break;
        }
    }
    if(flag){
        cout << pow(2, human.size()) << endl;;
    }
    else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 384