akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#include"atcoder/all"


#ifdef _MSC_VER
#include <intrin.h>

#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using namespace atcoder;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << endl
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;


struct UnionFind {
	int N;
	vector<int> siz;
	vector<int> par;
	vector<int> Rank;
	UnionFind(int n) : siz(n, 1), par(n), Rank(n, 0) {
		N = n;
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int find(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = find(par[x]);
		}
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (Rank[x] < Rank[y]) {
			par[x] = y;
			siz[x] += siz[y];
			siz[y] = siz[x];
		}
		else {
			siz[y] += siz[x];
			siz[x] = siz[y];
			par[y] = x;
			if (Rank[x] == Rank[y]) Rank[x]++;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
};
void solve() {
	int N, Q; cin >> N >> Q;
	UnionFind uf(N);
	REP(_, Q) {
		int t, u, v; cin >> t >> u >> v;
		if (t == 0)uf.unite(u, v);
		else {
			if (uf.same(u, v))print(1);
			else print(0);
		}
	}
}



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

	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 7660
//============================================================================
// Name        : JOI.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
int N;
int main() {
	cin>>N;
	int A,B,C,D;
	A=N/1000;
	B=(N%1000)/100;
	C=(N%1000)%100/10;
	D=N%10;
	int S=0;
	if((A+B+C+D)==7 && S==0){
		cout<<A<<"+"<<B<<"+"<<C<<"+"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A-B+C+D)==7 && S==0){
		cout<<A<<"-"<<B<<"+"<<C<<"+"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A+B-C+D)==7 && S==0){
		cout<<A<<"+"<<B<<"-"<<C<<"+"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A+B+C-D)==7 && S==0){
		cout<<A<<"+"<<B<<"+"<<C<<"-"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A-B-C+D)==7 && S==0){
		cout<<A<<"-"<<B<<"-"<<C<<"+"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A+B-C-D)==7 && S==0){
		cout<<A<<"+"<<B<<"-"<<C<<"-"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A-B+C-D)==7 && S==0){
		cout<<A<<"-"<<B<<"+"<<C<<"-"<<D<<"="<<7<<endl;
		S+=1;
	}
	if((A-B-C-D)==7 && S==0){
		cout<<A<<"-"<<B<<"-"<<C<<"-"<<D<<"-"<<7<<endl;
		S+=1;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



int modpow(int a, int p) {
	if (p == 0) return 1;
	if (p % 2 == 0) {

		int halfP = p / 2;
		int half = modpow(a, halfP);

		return half * half % mod;
	}
	else {
		
		return a * modpow(a, p - 1) % mod;
	}
}



int comb(int a, int b) {

	if (a == 0) {
		if (b == 0)return 1;
		else return 0;
	}

	//if (b > a - b) return comb(a, a - b);


	int ansMul = 1;
	int ansDiv = 1;
	for (int i = 0; i < b; i++)
	{
		ansMul *= (a - i);
		ansDiv *= (i + 1);
		ansMul %= mod;
		ansDiv %= mod;
	}
	
	int ans = ansMul * modpow(ansDiv, mod - 2) % mod;

	return ans;
}


int f2(int n, int k) {
	return comb(n + k - 1, k - 1);
}


int f(int n, int k) {
	if (n < k)return 0;
	if (n == 0 && k == 0)return 1;
	if (k < 1)return 0;
	return f2(n - k, k);
}

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

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

	eFOR(i,1, K) {
		int blue = f(K, i);
		int red = f2(N - K - (i - 1), i + 1);
		int ans = blue * red%mod;
		cout << ans << endl;
	}
	//cout << comb(N, K) << endl;
	return 0;
}



Measured memory_bytes: 256
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools
# import collections # queue
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    n,m = map(int,input().split())
    a = [0] * n
    for i in range(n):
        a[i] = list(input())
    b = [0] * m
    for i in range(m):
        b[i] = list(input())
    if n==m:
        for i in range(n):
            for j in range(n):
                if a[i][j]!=b[i][j]:
                    print("No")
                    return
        print("Yes")
        return
    for i in range(n-m):
        for j in range(n-m):
            tmp = True
            for k in range(m):
                for l in range(m):
                    if a[i+k][j+l]!=b[k][l]:
                        tmp = False
                        break
                if not tmp:
                    break
            if tmp:
                print("Yes")
                return
    print("No")
    return

if __name__=='__main__':
    main()


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

int main() {
    int N, M;
    cin >> N >> M;

    vector<string> A(N);
    vector<string> B(M);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }

    for (int i = 0; i < N - M + 1; i++) {
        for (int j = 0; j < N - M + 1; j++) {
            bool same = true;
            for (int k = 0; k < M; k++) {
                for (int l = 0; l < M; l++) {
                    if (B[k][l] != A[k + i][l + j]) {
                        same = false;
                    }
                }
            }
            if (same) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3588
# include <stdio.h>

int main(){
	int dish[25];
	int points[55];
	int extra[55];
	int n;
	int max = 0;
	int ex = 0;

	scanf("%d", &n);
	for (int j = 0; j < n; ++j){
		scanf("%d", &dish[j]);
	}
	for (int v = 0; v < n; ++v){
		scanf("%d", &points[v]);
	}

	for (int h = 0; h < n-1; ++h){
		scanf("%d", &extra[h]);
	}

	for (int i = 0; i < n; ++i){
		for (int k = 0; k < n; ++k){
			if (dish[i] == k+1){
				max = max + points[k];
				
				if (i != 0 && dish[i] - dish[i-1] == 1){
					max = max + extra[dish[i-1]-1];
					ex = ex+1;
				}
			}
		}
	}

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


	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<'\n'
#define trace3(x, y, z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<" "<<#z<<" = "<<z<<'\n'
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	int a, b;
	bool operator < (ii o) const { return tie(a, b) < tie(o.a, o.b); }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return tie(a, b, c) < tie(o.a, o.b, o.c); }
};
int TC, N, M, K, Q, x, y, z;
long long mod(long long n) { return (n%MOD + MOD)%MOD; }
long long kali(long long a, long long b, long long c = 1, long long d = 1) { return mod(mod(a*b)*mod(c*d)); }

int arr[MAXN];

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	
	scanf("%d%d%d", &N, &M, &K);
	for (int i = 0; i < N; i++) scanf("%d", &arr[i]);
	sort(arr, arr+N);
	
	int ans = 0;
	int nowBus = 0, cntBus = 0;
	for (int i = 0; i < N; i++) {
		if (arr[i] > nowBus || cntBus == M) {
			ans++;
			nowBus = arr[i]+K;
			cntBus = 1;
		} else {
			cntBus++;
		}
	}
	printf("%d\n", ans);
	
	return 0;
}


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

const int N = 100;

char s[2][N];

int main(){
	scanf("%s%s", s[0], s[1]);
	for (int i = 0; ; ++ i){
		char ch = s[i & 1][i >> 1];
		if (ch == '\0'){
			return printf("\n"), 0;
		}
		putchar(ch);
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265
#define endl '\n'
#define MAX 501

ll arr[MAX][MAX];

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

    int n , m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> arr[i][j];
        }
    }
    vector<pair<PII , PII> > vec;
    PII p;

    p.first = 1;
    p.second = 1;
    for (int i = 1; i <= n; i++) {
        if (i & 1) {
            for (int j = 1 + (i == 1); j <= m; j++) {
                int a = arr[p.first - 1][p.second - 1];
                int b = arr[i - 1][j - 1];
                if (arr[p.first - 1][p.second - 1] && (a & 1)) vec.pb({p,{i , j}}) , arr[i - 1][j - 1]++;
                p = {i , j};
            }
        }
        else {
            for (int j = m; j >= 1; j--) {
                int a = arr[p.first - 1][p.second - 1];
                int b = arr[i - 1][j - 1];
                if (arr[p.first - 1][p.second - 1] && (a & 1)) vec.pb({p ,{i , j}}) , arr[i - 1][j - 1]++;
                p = {i , j};
            }
        }
    }
    cout << vec.size() << endl;
    for (auto it : vec) {
        cout << it.first.first << " " << it.first.second << " " << it.second.first << " " << it.second.second << endl;
    }


    return 0;
}


Measured memory_bytes: 6128
MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
ans, rem = 0, 0
for i in range(n - 1):
    rem += a[n - 1 - i] % MOD
    ans += a[n - 2 - i] * rem % MOD
print(ans % MOD)

Measured memory_bytes: 31580
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
use std::char;
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        k: usize,
        d: [i64; k],
    }
    for i in 0.. {
        let mut ret = n + i;
        let mut f = true;
        while ret != 0 {
            if d.iter().find(|&&x| x==ret%10) != None {
                f = false;
                break;
            }
            ret /=10;
        }
        if f == true {
            println!("{}", n+i);
            return;
        }
    }
}
/*
9900 8
1 3 4 5 6 7 8 9
*/

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

typedef long long int ll;

void dfs(ll node, ll cnt, vector<tuple<ll,ll,ll,ll,vector<ll> > >&s)
{
    get<2>(s[node]) = cnt;
    for(ll i = 0;i < get<1>(s[node]);i++){
        dfs(get<4>(s[node])[i], cnt + 1, s);
    }
}

int main()
{
    ll n;
    cin >> n;
    vector<tuple<ll,ll,ll,ll,vector<ll> > > s(n);//id0 k1 d2 p3 c4
    for(ll i = 0;i < n;i++){
        cin >> get<0>(s[i]) >> get<1>(s[i]);
        vector<ll> a(get<1>(s[i]));
        get<4>(s[i]) = a;
        for(ll j = 0;j < get<1>(s[i]);j++){
            cin >> get<4>(s[i])[j];
        }
    }

    sort(s.begin(),s.end());

    for(ll i = 0;i < n;i++){
        for(ll j = 0;j < get<1>(s[i]);j++){
            get<3>(s[get<4>(s[i])[j]]) = get<0>(s[i]);
        }
    }

    for(ll i = 0;i < n;i++){
        if(get<2>(s[i]) == 0){
            dfs(i, 0, s);
        }
    }

    for(ll i = 0;i < n;i++){
        if(get<2>(s[i]) == 0){
            get<3>(s[i]) = -1;
        }
    }


    for(ll i = 0;i < n;i++){
        cout << "node " << i << ":" << " parent = " << get<3>(s[i]) << ", depth = " << get<2>(s[i]) << ", ";
        if(get<3>(s[i]) == -1){
            cout << "root, [";
        }
        else if(get<1>(s[i]) == 0){
            cout << "leaf, [";
        }
        else{
            cout << "internal node, [";
        }
        for(ll j = 0;j < get<1>(s[i]);j++){
            cout << get<4>(s[i])[j];
            if(get<1>(s[i]) - 1 == j){

            }
            else{
                cout << ", ";
            }
        }
        cout << "]\n";
    }

    return 0;
}



Measured memory_bytes: 9936
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
res=0
m=1

for i in a:
    b=m-i
    if b<0:
        print(-1)
        exit(0)
    res+=i
    res+=b
    s-=i
    m=min(b*2,s)
print(res)


Measured memory_bytes: 20064
using System;

namespace Q2
{
    class Program
    {
        static void Main(string[] args)
        {
            String line;
            line = Console.ReadLine();
            String sentence = line;

            line = Console.ReadLine();
            int w = int.Parse(line);
            string result = "";

            for(int i = 0; i < sentence.Length; i+=w)
            {
                result += sentence[i];
            }


            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13140
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun main(args: Array<String>) {
    val N = readInt()
    val H = readIntList()
    var res = 0
    var i = 0
    while (i < N - 1) {
        var j = i
        while (j < N) {
            if (j == N - 1 || H[j] < H[j + 1]) {
                res = (j - i).coerceAtLeast(res)
                i = j
                break
            }
            j++
        }
        i++
    }
    println(res)
}

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

// macro
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
using ll = long long;
using P = pair<int,int>;

// code starts
int main()
{
  string s;
  cin >> s;
  int i;
  int kans = 0;
  int ans = 0;
  rep(i,3)
  {
    if(s[i]== 'S')
    {
      kans = 0;
    }
    else
    {
      kans++;
      ans = max(ans,kans);
    }
    
  }
  cout << ans << endl;
}


Measured memory_bytes: 3588
sx,sy,tx,ty = map(int,input().split())

dx = tx-sx
dy = ty-sy

Ans = "U"*dy + "R"*dx + "D"*dy + "L"*dx
Ans += "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
Ans += "R" + "D"*(dy+1) + "L"*(dx+1) + "U"

print(Ans)

Measured memory_bytes: 3060
def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp


N ,M = map(int, input().split())
mod = 1000000007

if N==M:
    print((2*factorial(N)**2) % mod )
elif abs(N-M)==1:
    print((factorial(N)*factorial(M))%mod)
else:
    print(0)



Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main() {
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    bool ok = false;
    int i, l = n/100;
    for(i=1; i<=l; i++){
        if(n>=(i*100) && n<=(i*105)){
            ok = true;
            break;
        }
    }
    if(ok) cout << "1\n";
    else cout << "0\n";
    return 0;
}

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, N: int, A: "List[int]"):
    if sum(A)>=H:
        print(YES)
    else:
        print(NO)
    #return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14452
def gcd(a,b):
    c=0
    while b:(a,b),c=(b,a%b),c+1
    print(a,c)
  
while 1:
    n,m=map(int,input().split())
    if n==0:break
    gcd(n,m) if n>m else gcd(m,n)


Measured memory_bytes: 5604
object Main extends App {
  val Array(n,d) = io.StdIn.readLine.split(" ").map(_.toInt)
  val xss = Range(0,n).map{_ => io.StdIn.readLine.split(" ").map(_.toInt).toList }
  println(Range(0,n).map{i=>
    Range(i+1,n).map{j=>
      val k = xss(i).zip(xss(j)).map{z=>(z._1-z._2)*(z._1-z._2)}.sum
      val l = math.sqrt(k).toInt
      if(l * l == k) 1 else 0
    }.sum
  }.sum)
}

Measured memory_bytes: 27456
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int N,D,X,sum=0;
  cin>>N>>D>>X;
  int A[N];
  for(int i=0;i<N;i++) cin>>A[i];
  
  for(int k=0;k<N;k++){
    for(int i=1;i<=D;i++){
      for(int j=0;j*A[k]+1<=D;j++){
        if(j*A[k]+1==i) sum++;
      }
    }
  }
  
  cout<<sum+X<<endl;
}	


Measured memory_bytes: 256
printLine :: Int -> String
printLine 0 = "\n"
printLine n = "#" ++ printLine (n - 1)

printRect :: Int -> Int -> String
printRect 0 _ = ""
printRect h w = printLine w ++ printRect (h - 1) w

main = do
  hw <- getLine
  if hw == "0 0"
    then
      return []
    else do
      let lhw = map (read :: String -> Int) $ words hw
      putStrLn $ printRect (lhw !! 0) $ lhw !! 1
      main

Measured memory_bytes: 4016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define init(n) int n;cin>>n;int a[n];rep(i,n)cin>>a[i];
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll mod=1000000007;
ll add(ll a,ll b){
    return (a+b)%mod;
}
ll mul(ll a, ll b){
    return (a*b)%mod;
}
struct node
{
    ll x,y;    
};
int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);   
    // freopen("output.txt", "w", stdout);
    // #endif
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T;T=1;
    // cin>>T;
    while(T--){
        int n;cin>>n;
        string a,b;cin>>a>>b;
        string c;
        rep(i,n){c.pb(a[i]);c.pb(b[i]);}
        cout<<c;
    }
    return 0;   
}

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

int main() {
    
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    int ok = 0;
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i];
        int ok = 1;
        if(i >= 2){
            for(int j=i-2; j<=i; j++){
                ok &= (a[j] == b[j]);
            }
            if(ok){
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  A=(A+D-1)/D;
  C=(C+B-1)/B;
  if(A>=C)
    puts("Yes");
  else	puts("No");
  return 0;
}

Measured memory_bytes: 3592
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: AmShZ6
 * Time: 2020-05-30 16:31:04
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll h1 , m1 , h2 , m2 , k;

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

    cin >> h1 >> m1 >> h2 >> m2 >> k;
    cout << max(0ll , h2 * 60 + m2 - (h1 * 60 + m1) - k) << endl;

    return 0;
}
/*

*/


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

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

Measured memory_bytes: 128
#include<stdio.h>
using namespace std;
int main( ){
    int n,m;
    int Min=1e9;
    int ans=0;
    int k;
    scanf("%d%d",&n,&m);
    for (int i=1; i<=n; ++i ){
        scanf("%d",&k);
        if (k<Min) Min=k;
        m-=k;
        ans++;
    }
    printf("%d",ans+m/Min);
}


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

int main(){
    char s[9];
    scanf("%s",s);
    int ans;
    if(strcmp(s,"SUN") == 0){
        ans = 7;
    }else if(strcmp(s,"MON") == 0){
        ans = 6;
    }else if(strcmp(s,"TUE") == 0){
        ans = 5;
    }else if(strcmp(s,"WED") == 0){
        ans = 4;
    }else if(strcmp(s,"THU") == 0){
        ans = 3;
    }else if(strcmp(s,"FRI") == 0){
        ans = 2;
    }else if(strcmp(s,"SAT") == 0){
        ans = 1;
    }
    printf("%d\n", ans);
    return 0;
}

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

int main(){
    int c[4] = {0};
    int a, b;
    for(int i=0; i<3; i++){
        cin >> a >> b;
        c[a-1]++;
        c[b-1]++;
    }
    for(int i=0; i<4; i++){
        // cout << c[i] << endl;
        if(c[i] >=3 || c[i] == 0){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

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;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int i,j;
	int n,m;
	cin>>n>>m;
	cout<<n*(n-1)/2+m*(m-1)/2<<endl;

}

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

int main(void){
    int W,H,x,y,r;
    
    cin >>W>>H>>x>>y>>r;
    if (x + r > W || x - r < 0 || y + r > H || y - r < 0){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

bool cmp(pii a,pii b){
	return a.first+a.second>b.first+b.second;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<pii> a(n);
	rep(i,n) cin >> a.at(i).first >> a.at(i).second;
	sort(a.begin(),a.end(),cmp);
	ll taka=0,ao=0;
	rep(i,n){
		if(i%2==0) taka+=a.at(i).first;
		else ao+=a.at(i).second;
	}
	cout << taka-ao << endl;
}

Measured memory_bytes: 1024
import Data.List
import Data.Char
import Data.Functor
import qualified Data.ByteString.Char8 as B

main :: IO()
main = do
  xs <- getInts
  f xs

f :: [Int] -> IO()
f [] = return()
f (x:y:xs) = do
  putStrLn . show $ length $ show (x+y)
  f xs

getInts :: IO[Int]
getInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getContents

Measured memory_bytes: 3736
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int max = (int) Math.pow(m, (double) 1 / n);
		
		int ans = 0;
		for(int i = 1; i <= max; i++) {
			int x = (int) Math.pow(i, n);
			String str = String.valueOf(x);
			int y = 0;
			for(int j = 0; j < str.length(); j++) {
				y += Integer.parseInt(str.substring(j, j + 1));
			}
			
			if(y + a == i) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 26952
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Wed Jan 16 16:43:18 2019
//
package main

import (
	"container/heap"
	"fmt"
	"sort"
)

type point struct {
	index int
	x, y  int
}

func (p point) xLess(q point) bool {
	if p.x == q.x {
		return p.y < q.y
	}
	return p.x < q.x
}

func (p point) yLess(q point) bool {
	if p.y == q.y {
		return p.x < q.y
	}

	return p.y < q.y
}

type xpoints []point

func (xp xpoints) Len() int {
	return len(xp)
}

func (xp xpoints) Less(i, j int) bool {
	return xp[i].xLess(xp[j])
}

func (xp xpoints) Swap(i, j int) {
	xp[i], xp[j] = xp[j], xp[i]
}

type ypoints []point

func (yp ypoints) Len() int {
	return len(yp)
}

func (yp ypoints) Less(i, j int) bool {
	return yp[i].yLess(yp[j])
}

func (yp ypoints) Swap(i, j int) {
	yp[i], yp[j] = yp[j], yp[i]
}

type route struct {
	to, weight int
}

type item struct {
	r     route
	index int
}

type pQ []*item

func (pq pQ) Len() int {
	return len(pq)
}

func (pq pQ) Less(i, j int) bool {
	return pq[i].r.weight < pq[j].r.weight
}

func (pq pQ) Swap(i, j int) {
	pq[i].r, pq[j].r = pq[j].r, pq[i].r
	pq[i].index, pq[j].index = pq[j].index, pq[i].index
}

func (pq *pQ) Push(p interface{}) {
	x := p.(*item)
	x.index = len(*pq)
	*pq = append(*pq, x)
}

func (pq *pQ) Pop() interface{} {
	old := *pq
	n := len(old)
	i := old[n-1]
	*pq = old[0 : n-1]
	return i
}

func prim(g [][]route) int {
	visited := make([]bool, len(g))

	visited[0] = true
	pq := make(pQ, len(g[0]))
	for i := range g[0] {
		r := g[0][i]
		pq[i] = &item{r: r}
	}
	heap.Init(&pq)

	ans := 0
	for len(pq) > 0 {
		p := heap.Pop(&pq).(*item)
		if !visited[p.r.to] {
			ans += p.r.weight
			visited[p.r.to] = true
			for i := range g[p.r.to] {
				heap.Push(&pq, &item{r: g[p.r.to][i]})
			}
		}
	}

	return ans
}

func main() {
	var N int
	fmt.Scan(&N)

	xps := make(xpoints, N)
	yps := make(ypoints, N)
	for i := range xps {
		fmt.Scan(&xps[i].x, &xps[i].y)
		xps[i].index = i
		yps[i].index, yps[i].x, yps[i].y = xps[i].index, xps[i].x, xps[i].y
	}
	sort.Sort(xps)
	sort.Sort(yps)

	g := make([][]route, N)
	for i := range xps {
		if i+1 < len(xps) {
			d := xps[i+1].x - xps[i].x
			a, b := xps[i].index, xps[i+1].index
			g[a] = append(g[a], route{to: b, weight: d})
			g[b] = append(g[b], route{to: a, weight: d})
		}
		if i+1 < len(yps) {
			d := yps[i+1].y - yps[i].y
			a, b := yps[i].index, yps[i+1].index
			g[a] = append(g[a], route{to: b, weight: d})
			g[b] = append(g[b], route{to: a, weight: d})
		}
	}

	fmt.Println(prim(g))
}


Measured memory_bytes: 30080
//SAIKH SERAJ FAHIM, CSE-HSTU, DINAJPUR, BANGLADESH.

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin>>a;
    string s=to_string(a);
    reverse(s.begin(),s.end());
    if(s[0]=='0' || s[0]=='1' || s[0]=='6' || s[0]=='8')
        cout<<"pon"<<"\n";
    else if(s[0]=='2' || s[0]=='4' || s[0]=='5' || s[0]=='7' || s[0]=='9')
        cout<<"hon"<<"\n";
    else
        cout<<"bon"<<"\n";
    return 0;
}


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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)
#define lower_bound_idx(V,c) distance(V.begin(),lower_bound(V.begin(),V.end(),c))

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    int N;
    cin>>N;
    vector<int> A(N);
    vector<vector<int>> x(15,vector<int>(N)),y(15,vector<int>(N));
    rep(i,N){
        cin>>A[i];
        rep(k,A[i]){
            cin>>x[i][k]>>y[i][k];
            x[i][k]--;
        }
    }
    int ans=0;
    ll T=1LL<<N;
    rep(t,T){
        bool isok=true;
        rep(i,N){
            if(!(t&(1<<i)))continue;
            rep(k,A[i]){
                if(y[i][k]==0 && (t&(1<<x[i][k])) || y[i][k]==1 && !(t&(1<<x[i][k]))){
                    isok=false;break;
                }
            }
        }
        if(isok){
            chmax(ans,__builtin_popcount(t));

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

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int n, k, ans;

	cin >> n >> k;

	int b = n - k;

	ans = b / (k - 1);

	if (b % (k - 1)) {
		ans++;
	}

	cout << ans + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <string>

using namespace std;

unordered_map<string, int > aMap{
    {"SUN", 7},
    {"MON", 6},
    {"TUE", 5},
    {"WED", 4},
    {"THU", 3},
    {"FRI", 2},
    {"SAT", 1}
};


int main(int argc, char** argv){
    string strIN;
    cin >> strIN;
    auto it = aMap.find( strIN );
    if( it != aMap.end() ){
        cout << it->second << endl;
    }
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    ll N,X[110],Y[110],H[110];
    cin >> N;
    tuple<ll,ll,ll>G=make_tuple(-1,-1,-1);
    rep(i,N){
        cin >> X[i] >> Y[i] >> H[i];
        if(H[i]>=1) G = make_tuple(X[i],Y[i],H[i]);
    }
    rep(i,101){
        rep(j,101){
            ll V=get<2>(G)+abs(get<0>(G)-i)+abs(get<1>(G)-j);
            bool can = true;
            rep(k,N){
                if(H[k]!=max((ll)V-abs(X[k]-i)-abs(Y[k]-j),(ll)0))
                can = false; 
            }
            if(can) {cout << i <<" "<< j <<" "<< V << endl; return 0;} 
        }
    }

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    int N, M;
    cin >> N >> M;
    cout << (1 << M) * (1900 * M + 100 * (N - M)) << "\n";
    return 0;
}


Measured memory_bytes: 3572
n,m=map(int,input().split())
dp=[0]*(n+1)
dp[0]=1
a=b=0
if b<m:a=int(input())
for i in range(1,n+1):
  if i==a:
    b+=1
    if b<m:a=int(input())
  else:
    dp[i]=dp[i-1]
    if i>1:dp[i]+=dp[i-2]
  dp[i]%=(10**9+7)
print(dp[-1])

Measured memory_bytes: 6900
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    A = list(map(int, stdinput().split()))

    done = True
    count = 0
    while done:
        done = False
        for i in range(n-1, 0, -1):
            if A[i] < A[i-1]:
                A[i], A[i-1] = A[i-1], A[i]
                done = True
                count += 1
    
    print(' '.join(map(str, A)))
    print(count)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5604
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    int n, l;
    string *s;
    cin >> n >> l;
    s = new string[n];
    for (int i = 0; i < n; i++)
        cin >> s[i];

    sort(s, s+n);

    for (int i = 0; i < n; i++)
        cout << s[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int w,h,x,y;

    scanf("%d %d %d %d",&w,&h,&x,&y);

    printf("%lf ",(double)w * h / 2);

    if ((x == (double)w / 2) && (y == (double)h / 2))
    {
        printf("1");
    }
    else
    {
        printf("0");
    }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,m,q,dp[501][501],l,r,x,y;
int main()
{
	cin>>n>>m>>q;
	for (int i=0;i<m;i++)
	{
		cin>>l>>r;
		for (int j=r;j<501;j++) dp[l][j]++;
	}
	for (int i=0;i<q;i++)
	{
		cin>>x>>y;
		int ans=0;
		for (int j=x;j<=y;j++) ans+=dp[j][y];
		cout<<ans;
		if (i!=q-1) cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1920
n,y=map(int,input().split())

def search():
    for b in range(0,n+1):
        for a in range(0,n+1):
            c=n-a-b
            total = 10000*a+5000*b+1000*c
            if(y==total and c>=0):
                return(a,b,c)
    return(-1,-1,-1)
print("%d %d %d" % search())

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef long long ll;
ll MOD = 1000000007;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

	ll n;
	cin >> n;
	vector<ll>a(n);
	rep(i, n)cin >> a[i];
	while (true) {
		a.erase(remove(all(a), 0), a.end());
		sort(all(a));
		if (a.size() == 1)return cout << *min_element(all(a)) << endl, 0;
		else {
			for (ll i = 1; i < a.size(); i++)a[i] %= a[0];
		}
	}
}


Measured memory_bytes: 1024
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)
ResMin = float('inf')

for i in range(len(h)-K+1):
    tmp = h[i+K-1] - h[i]
    if tmp < ResMin:
        ResMin = tmp

print(ResMin)

Measured memory_bytes: 8280
import sys

N, M = map(int, input().split())
AB = []
for _ in range(N):
    a, b = map(int, input().split())
    AB.append((a, b))
AB.sort(key=lambda x: x[0])
ans = 0
num = 0
for a, b in AB:
    if num + b >= M:
        ans += a * (M - num)
        print(ans)
        sys.exit()
    ans += a * b
    num += b


Measured memory_bytes: 18164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    string s;
    cin >> s;
    ll k;
    cin >> k;

    char ans;
    if(k <= s.length()){
        ll ones = 0;
        for(int i=0; i<k; i++){
            if(s[i] == '1') ones++;
            else{
                ans = s[i];
                break;
            }
        }
        if(ones == k) ans = '1';
    }
    else{
        ll ones = 0;
        for(int i=0; i<s.length(); i++){
            if(s[i] == '1') ones++;
            else{
                ans = s[i];
                break;
            }
        }
        if(ones == s.length()) ans = '1';
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = gets.to_i
Mod = 10 ** 9 + 7

def inverse(a)
  pows = [1,]
  for i in 1..35 do
    if i == 1 then
      pows[i] = a
    else
      pows[i] = (pows[i-1] ** 2) % Mod
    end
  end
  result = 1
  for i in 1..35 do
    if (Mod-2)[i-1] == 1 then
      result = (result * pows[i]) % Mod
    end
  end
  return(result)
end
  
kai = [1,1]      # 0!, 1!
for i in 2..10000 do      # kai[n] = n!
  kai[i] = (kai[i-1] * i) % Mod
end
  
len_max = S / 3

ans = 0
for i in 1..len_max do
  ans = (ans + kai[S-2*i-1] * inverse(kai[i-1]) * inverse(kai[S-3*i])) % Mod
end
puts ans

Measured memory_bytes: 15076
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    lint A;
    string B;
    cin >> A >> B;
    lint L=B.length();
    lint b=0;
    lint keisu=1;
    for(int i=L-1;i>=0;i--){
        if(B[i]=='.') continue;
        b+=keisu*(B[i]-'0');
        keisu*=10;
    }
    lint ans=A*b;
    cout << ans/100 << endl;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define rep(i,b) for(int i=1;i<=b;i++)
#define drep(i,b) for(int i=b;i>=1;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pr pair<int,int>
#define ff first
#define ss second
#define int long long
#define endl '\n'
using namespace std;
const int N=2e5+5;
const int mod=1e9+7;
int n,m,k,t,x,y,z;

void solve(int ans=0) {
    cin>>x>>y;
    cin>>n>>m;
    double t=n*30+m/2.0;
    double t2=m*6;
    t*=acos(-1.0)/180;
    t2*=acos(-1.0)/180;
    double _x=x*cos(t)-y*cos(t2);
    double _y=x*sin(t)-y*sin(t2);
    cout<<fixed<<setprecision(11)<<sqrt(_x*_x+_y*_y)<<endl;
}

#undef int
int main() {
    ios::sync_with_stdio(false);
    //int T;cin>>T;
    //while(T--)
        solve();
}


Measured memory_bytes: 4112
package main

import (
	"fmt"
	"strings"
)

func main() {
	var a string
	fmt.Scan(&a)
	A := strings.Split(a, "")
	if A[2] == A[3] && A[4] == A[5] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

const int INF = 1e9 + 9;

int dx1[] = {-1, 0, 1};
int dy1[] = {-1, 0, 1};
int dx2[] = {-2, -1, 0, 1, 2};
int dy2[] = {-2, -1, 0, 1, 2};

using namespace std;

int main(){
  int H, W;
  cin >> H >> W;
  
  int Ch, Cw, Dh, Dw;
  cin >> Ch >> Cw >> Dh >> Dw;
  --Ch; --Cw; --Dh; --Dw;
  
  vector<string> S(H);
  for(int i = 0; i < H; i++) cin >> S[i];
  
  priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, pair<int, int>>>> pq;
  pq.push({0, {Ch, Cw}});
  
  vector<vector<int>> dist(H, vector<int>(W, INF));
  dist[Ch][Cw] = 0;
  while(pq.size()){
    int cost = pq.top().first;
    int node_h = pq.top().second.first;
    int node_w = pq.top().second.second;
    pq.pop();
    
    if(dist[node_h][node_w] < cost) continue;
    
    for(int x : dx1){
      for(int y : dy1){
        if(x == 0 && y == 0) continue;
        if(x != 0 && y != 0) continue;
        
        if(0 <= node_h + y && node_h + y < H && 0 <= node_w + x && node_w + x < W && S[node_h + y][node_w + x] == '.'){
          if(dist[node_h + y][node_w + x] <= cost) continue;
          
          dist[node_h + y][node_w + x] = cost;
          pq.push({cost, {node_h + y, node_w + x}});
        }
      }
    }
    
    for(int x : dx2){
      for(int y : dy2){
        if(x == 0 && y == 0) continue;
        if(0 <= node_h + y && node_h + y < H && 0 <= node_w + x && node_w + x < W && S[node_h + y][node_w + x] == '.'){
          if(dist[node_h + y][node_w + x] <= cost + 1) continue;
          
          dist[node_h + y][node_w + x] = cost + 1;
          pq.push({cost + 1, {node_h + y, node_w + x}});
        }
      }
    }
  }
  
  if(dist[Dh][Dw] < INF) cout << dist[Dh][Dw] << endl;
  else cout << -1 << endl;
  
  return 0;
}

Measured memory_bytes: 9592
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;


struct ST {
	int x;
	int y;
	int c;
};

char map[1000 + 10][1000 + 10];

bool wen[1000 + 10][1000 + 10] = { 0 };

int main()
{
	int ly, lx, n;

	ST m, tm;

	queue<ST> qu;

	int gy[] = {1,0,-1,0};
	int gx[] = {0,1,0,-1};

	char G[10 + 5] = { '0','1','2','3','4','5','6','7','8','9' };

	int sum = 0;
	int sy, sx;
	int i, j;

	cin >> ly >> lx >> n;

	for (i = 1; i <= ly; i++)
	{
		cin >> map[i] + 1;

		map[i][0] = 'X';
		map[i][lx + 1] = 'X';

		for (j = 1; j <= lx; j++)
		{
			if (map[i][j] == 'S')
			{
				sy = i;
				sx = j;
			}
		}
	}
	for (i = 0; i <= lx + 1; i++)
	{
		map[0][i] = 'X';
		map[ly + 1][i] = 'X';
	}

	m.y = sy;
	m.x = sx;
	m.c = 0;

	qu.push(m);

	for (i = 1; i <= n; i++)
	{
		while (!qu.empty())
		{
			m = qu.front();

			qu.pop();

			if (wen[m.y][m.x])
			{
				continue;
			}
			wen[m.y][m.x] = true;

			if (map[m.y][m.x] == G[i])
			{
				sum += m.c;

				while (!qu.empty())
				{
					qu.pop();
				}
				memset(wen, 0, sizeof(wen));

				m.c = 0;

				qu.push(m);

				break;
			}

			for (j = 0; j < 4; j++)
			{
				tm.y = m.y + gy[j];
				tm.x = m.x + gx[j];
				tm.c = m.c + 1;

				if (map[tm.y][tm.x] != 'X' && !wen[tm.y][tm.x] )
				{
					qu.push(tm);
				}
			}
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 5132
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll MOD = 1000000007;
ll INF =1<<30;

int main(){
    int n,x,t;
    cin >> n >> x>>t;
    cout << (n+x-1)/x*t <<endl;
}

Measured memory_bytes: 3536
#include <iostream>
#include <string>

int main()
{
	std::string T, P;
	getline(std::cin, T);
	getline(std::cin, P);
	
	for (int i=0; i<T.length(); i++) {
		bool matched = true;
		for (int j=0; j<P.length(); j++) {
			if (T[i+j] != P[j]) {
				matched = false; break;	
			}
		}
		if (matched) std::cout << i << std::endl;
	}
	
	return 0;
}
		



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

int main(){
    int n;
    cin >> n;
    char s[n];

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

    int ans = 0;
    char current = ' ';

    for(int i = 0 ;i < n; i++){
        if(s[i] != current){
            current = s[i];
            ans +=  1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
// ?????¬???????????¬?????? (????°????)

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
typedef pair<int, int> pii;
typedef long long ll;
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

// s ????????????????????? t ?????¨??? u ????????????
string replace_user(string s, string t, string u) {
    reverse(t.begin(), t.end());
    size_t N = s.length(), M = t.length();
    if(N < M) return s;

    string ret = "", temp = "";
    for(size_t i=0; i<N; i++) {
        if(temp.length() == M) {
            ret += temp.back();
            temp.pop_back();
        }
        temp = s[i] + temp;
        if(temp == t) {
            ret += u;
            temp = "";
        }
    }
    reverse(temp.begin(), temp.end());
    s = ret + temp;
    return s;
}

map<string, int> m;

void solve(string s) {
    if(m.count(s)) return;
    m[s]++;
    s = replace_user(s, "ABC", "X");
    int cnt[3] = {};
    rep(i,0,s.length()) if(s[i] != 'X') cnt[ s[i] - 'A' ]++;
    rep(i,0,3) {
        if(cnt[i]) continue;
        s = replace_user(s, "X", string(1, (char)('A' + i)));
        if(!m.count(s)) solve(s);
    }
}

signed main() {
    string s; cin >> s;
    solve(s);
    if(m.count("ABC")) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 16020