akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    String input = scanner.nextLine();
    switch(input) {
      case "A":
        System.out.println("T");
        break;
      case "C":
        System.out.println("G");
        break;
      case "T":
        System.out.println("A");
        break;
      case "G":
        System.out.println("C");
        break;
      default:
        System.out.println("Please input only A/C/T/G");
        break;
    }
  }
}

Measured memory_bytes: 21204
#include <stdio.h>
int main(void){
    int x, y, t;
    
    while(1){
        scanf("%d %d", &x, &y);
        if(x == 0 && y == 0){
            break;
        }
        if(x > y){
            t = x;
            x = y;
            y = t;
        }
    printf("%d %d\n", x, y);
    }
    return 0;
}


Measured memory_bytes: 1984
#include <iostream>
#include <vector>
#include <numeric>

int main()
{
    std::vector<int> v(3, 0);
    std::string s;

    std::cin >> s;

    for (int i = 0; i < 3; i++)
    {
        v[i] = s[i] - '0';
    }

    int sum = std::accumulate(v.begin(), v.end(), 0);
    std::cout << sum << std::endl;

    return 0;
}

Measured memory_bytes: 384
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
char in[1100][1100];
long long dp[1100][1100];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%s",in[i]);
	}
	dp[0][0]=1;
	for(int i=0;i<a;i++)for(int j=0;j<b;j++){
		if(in[i][j]=='#')continue;
		if(i-1>=0)dp[i][j]=(dp[i-1][j]+dp[i][j])%mod;
		if(j-1>=0)dp[i][j]=(dp[i][j-1]+dp[i][j])%mod;
	}
	printf("%lld\n",dp[a-1][b-1]);
}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



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

  string s, t;
  cin >> s >> t;
  s += s;
  YesorNo(s.find(t) != string::npos);
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
//const int MOD = 1000000007;
const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

///////////////////////////////////////////////////////////
int n,a,b,k;
signed main(){
  cin>>n>>a>>b>>k;
  int ans = 0;
  COMinit();
  rep(p,n+1){
    if(a*p > k || (k-a*p)%b != 0)continue;
    int q = (k-a*p)/b;
    ans = (ans + COM(n,p)*COM(n,q)%MOD) % MOD;
  }
  cout << ans << endl;
}



Measured memory_bytes: 117376
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(void) {
	int H, W;
	scanf("%d %d", &H, &W);
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			string s;
			cin >> s;
			if (s == "snuke") {
				cout << string(1, 'A' + j) << i + 1 << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3704
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K = map(int, readline().split())

checked = [0] * N
for _ in range(K):
    d = int(readline())
    A = list(map(int1, readline().split()))
    for a in A:
        checked[a] += 1

cnt = sum([c == 0 for c in checked])
print(cnt)


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

int main() {
  
  string S;
  cin >> S;
    
  char s3 = S.at(2);
  char s4 = S.at(3);
  char s5 = S.at(4);
  char s6 = S.at(5);
  
  if (s3 == s4 && s5 == s6) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0; i<(int)(n); ++i)
#define rep2(i, a, b) for(int i=a; i<=(int)(b); ++i)
#define all(v) v.begin(),v.end()
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  unordered_map<ll, ll> m;
  rep(i, n) {
    cin >> a[i];
    m[0ll+i+a[i]]++;
  }
  ll ans = 0;
  rep(j, n) {
    ans += m[0ll+j-a[j]];
  }
  cout << ans << endl;
}

Measured memory_bytes: 20160
#include <iostream>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	int N; cin >> N;
	int A[200];
	rep(i, 0, N)cin >> A[i];

	int cnt = 0;
	while (1) {
		rep(i, 0, N) {
			if (A[i] % 2 == 1) {
				cout << cnt << endl;
				return 0;
			}
			A[i] /= 2;
		}
		cnt++;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void)
{
  char t[300000];
  scanf("%s",t);
  int len=strlen(t);
  for(int i=0;i<len;i++){
    if(t[i]=='?'){
      t[i]='D';
    }
  }
  printf("%s\n",t);
  return 0;
}


Measured memory_bytes: 1824
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto hw = readln.split.to!(int[]);
    auto H = hw[0];
    auto W = hw[1];
    auto MAP = new char[][](H, W);
    int bc;
    foreach (i; 0..H) foreach (j, c; readln.chomp.to!(char[])) {
        if (c == '#') ++bc;
        MAP[i][j] = c;
    }

    auto FS = new bool[][](H, W);
    FS[0][0] = true;
    auto ss = [[0, 0, 0]];
    int cnt;
    bool ok;
    while (!ss.empty) {
        auto h = ss[0];
        ss = ss[1..$];
        auto x = h[0];
        auto y = h[1];
        auto c = h[2];
        if (x == W-1 && y == H-1) {
            cnt = c-1;
            ok = true;
            break;
        }
        foreach (d; [[0,1], [1,0], [-1,0], [0,-1]]) {
            auto xd = x + d[0];
            auto yd = y + d[1];
            if (xd < 0 || xd >= W || yd < 0 || yd >= H || MAP[yd][xd] == '#' || FS[yd][xd]) continue;
            FS[yd][xd] = true;
            ss ~= [xd, yd, c+1];
        }
    }

    if (!ok) {
        writeln(-1);
    } else {
        writeln(H * W - cnt - bc - 2);
    }
}

Measured memory_bytes: 636
def Insert_sort(array,N):
    for i in range(1,N):
        temp = array[i]
        j = i - 1
        print(*array)
        while(j >= 0 ) and (array[j] >= temp):
            array[j+1] = array[j]
            
            j -= 1
        array[j+1] = temp
    print(*array)      
            
    #array= ' '.join(array)
    
    
try:
    N = int(input())
    array = list(map(int,input().split()))
except ValueError as N:
    print('数値以外が入力されました')

Insert_sort(array,N)




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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
typedef long long ll;
typedef vector<ll> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	int n,i,j;
	vi a,b,c;
	scanf("%d",&n);
	int bil;
	for(i=0;i<n;i++){scanf("%d",&bil); a.pb(bil);}
	for(i=0;i<n;i++){scanf("%d",&bil); b.pb(bil);}
	for(i=0;i<n;i++){scanf("%d",&bil); c.pb(bil);}
	sort(a.begin(),a.end()); sort(b.begin(),b.end()); sort(c.begin(),c.end());
	vi listIdxB,listBanyakCaraC;
	for(i=0;i<n;i++){
		// if(i){printf(" ");}
		// printf("i: %d\n",i);
		int idxB = lower_bound(b.begin(),b.end(), a[i]) - b.begin();
		if(idxB!=n){
			if(b[idxB]==a[i]){
				//cari sampe ketemu lebih besar
				int j = lower_bound(b.begin(),b.end(),a[i]+1) - b.begin();
				
				listIdxB.pb(j);
			}else{
				listIdxB.pb(idxB);
			}
		}else{
			listIdxB.pb(idxB);
	//		printf("masuk idxB: %d\n",idxB);
		}
		//printf("%d(idxB: %d)",a[i],idxB);

	}
	
	for(i=0;i<n;i++){
		//if(i){printf(" ");}
		int idxC = lower_bound(c.begin(),c.end(), b[i]) - c.begin();
		if(idxC!=n){
			if(c[idxC]==b[i]){
				int j = lower_bound(c.begin(),c.end(),b[i]+1) - c.begin();
				listBanyakCaraC.pb((ll)n-((ll)j));
			}
			else{listBanyakCaraC.pb((ll)n-idxC);}
		}else{
			listBanyakCaraC.pb((ll)n-idxC);
		}
		//printf("%d(idxC: %d banyakCara: %d)",b[i],idxC,n-idxC);
	}
	// printf("\n");
	// printf("listIdxB\n");
	// for(i=0;i<n;i++){
	// 	if(i){printf(" ");}
	// 	printf("%d",listIdxB[i]);
	// }
	// printf("\n");
	// printf("listBanyakCaraC size: %d\n",listBanyakCaraC.size());
	// for(i=0;i<n;i++){
	// 	if(i){printf(" ");}
	// 	printf("%d",listBanyakCaraC[i]);
	// }
	// printf("\n");
	vector<ll> listPrefixSum;
	listPrefixSum.assign(n+1,0);
	for(i=0;i<n;i++){
		if(i==0){listPrefixSum[i] = (ll)listBanyakCaraC[i];}
		else{listPrefixSum[i] = (ll)listBanyakCaraC[i] + (ll)listPrefixSum[i-1];}
	}
	ll sum = listPrefixSum[n-1];
	ll ans = 0;
	for(i=0;i<n;i++){
		int idx = listIdxB[i];
		if(idx-1<0){ans+=sum;}
		else{ans+=(sum-listPrefixSum[idx-1]);}
	}
	printf("%lld\n",ans);
	
	return 0;
};

Measured memory_bytes: 5108
import sys, os
import numpy as np

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c = input().split()
    if a[-1]== b[0] and b[-1] == c[0]:
        print('YES')
    else:
        print('NO')
    

solve()


Measured memory_bytes: 21412
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

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

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<ll> enum_div(ll n) {
    std::vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int N;
int ans = 0;
void rec(ll n) {
    if (n > N) return;
    stringstream ss;
    ss << n;
    int a = 0, b = 0, c = 0;
    string S = ss.str();
    REP(i, S.length()) {
        if (S[i] == '3') a++;
        if (S[i] == '5') b++;
        if (S[i] == '7') c++;
    }
    if (a > 0 && b > 0 && c > 0) ans++;
    rec(n * 10 + 3);
    rec(n * 10 + 5);
    rec(n * 10 + 7);
}

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

    cin >> N;
    rec(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, P = 998244353;
int n, m, ans, inv[N], fac[N];
int qp (int a, int b) { int c = 1; for (; b; b >>= 1, a = 1ll * a * a % P) if (b & 1) c = 1ll * c * a % P; return c; }
int main () {
	scanf("%d%d", &n, &m); if (n < m) n ^= m ^= n ^= m;
	inv[0] = inv[1] = 1; for (int i = 2; i <= n + m; ++i) inv[i] = 1ll * (P - P / i) * inv[P % i] % P;
	fac[0] = 1; for (int i = 1; i <= n + m; ++i) fac[i] = 1ll * fac[i - 1] * i % P, inv[i] = 1ll * inv[i] * inv[i - 1] % P;
	for (int i = 1; i <= m; ++i) ans = (1ll * fac[i << 1] * inv[i] % P * inv[i] % P * fac[n + m - (i << 1)] % P * inv[n - i] % P * inv[m - i] + ans) % P;
	return printf("%d\n", (1ll * ans * qp(1ll * fac[n + m] * inv[n] % P * inv[m] % P * 2 % P, P - 2) + n) % P), 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

int main(){

    string s;
    cin>>s;
    int cnt=0;
    REP(i,s.size()){
        if(s[i]=='p')cnt++;
    }
    cout<<s.size()/2-cnt<<endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <cmath>

template <typename T>
T gcd(T x, T y)
{
	return y == 0 ? x : gcd(y, x % y);
}

template <typename T>
std::vector<T> EratosthenesSieve(T n)
{
	std::vector<T> prime_numbers;

	std::vector<char> sieve(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		if (sieve.at(i) == 1)
		{
			prime_numbers.push_back(i);
			for (T j = i; j <= n; j += i)
			{
				sieve.at(j) = 0;
			}
		}
	}

	return std::move(prime_numbers);
}

template <typename T>
std::vector<std::pair<T, int>> primeFactorization(T n)
{
	std::vector<std::pair<T, int>> answer;

	std::vector<T> prime_numbers = EratosthenesSieve(static_cast<T>(std::sqrt(n)));
	for (T prime_number : prime_numbers)
	{
		if (prime_number * prime_number > n)
		{
			break;
		}

		if (n % prime_number != 0)
		{
			continue;
		}

		answer.emplace_back(prime_number, 0);
		do
		{
			n /= prime_number;
			answer.back().second++;
		} while (n % prime_number == 0);
	}

	if (n != 1)
	{
		answer.emplace_back(n, 1);
	}

	return std::move(answer);
}

int main()
{
	long long A, B;
	std::cin >> A >> B;

	auto g = gcd(A, B);
	auto pf = primeFactorization(g);

	std::cout << pf.size() + 1;

	return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  int same = 0;
  rep(i,n){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  s.erase(unique(s.begin(),s.end()),s.end());
  int size;
  size = s.size();
  cout << size << endl;
  return 0;
}


Measured memory_bytes: 9596
#include<bits/stdc++.h>
//#define long long ll ;
#define mod 1e+9;
#define rep for(int i=0;i<n;i++);
#define pb push_back;
#define popb pop_back;
using namespace std;
const int ma=1e6+9;
typedef long long ll;

int main()
{
//     #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
   ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    long double m;
    cin >> n >> m;
    long double x ,y;
    int count=0;

    for(int i=0;i<n;i++)
    {
      cin >> x>> y;
      long double temp;
      temp=sqrtl(x*x+y*y);
      if(temp<=m)
        count ++;
    }
    cout << count << endl;
  }


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

int main() {
  
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  
  if ( A+B > C+D ) {
    cout << "Left" << endl; 
  }
  
  else if ( A+B == C+D ) {
    cout << "Balanced" << endl; 
  }
  
  else {
    cout << "Right" << endl;
  }
}

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

using namespace std;

#define ll long long
#define pb push_back
#define F first
#define S second
#define rf(i,a,b) for(int (i) = (a); (i) <= (b); (i)++)
#define rb(i,b,a) for(int (i) = (b); (i) >= (a); (i)--)
#define watch(x) cout << (#x) << " = " << (x) << endl
#define test(t) int(testCnt) = 0; int(t); cin >> (t); while(t -- && ++testCnt)

const int INF = 2e9 + 7;
const int MAXA = 1e3 + 10;
const ll MOD = 1e9 + 7;
const ll INFLL = 9e18 + 7;

typedef pair<int, int> ii;
typedef pair<ii, int> II;
typedef vector<int> vi;
typedef vector<ii> vii;

int H, W;
ll f[MAXA][MAXA];
char a[MAXA][MAXA];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
       // freopen("in.in", "r", stdin);
    #endif
    cin >> H >> W;
    rf(i, 1, H)
        rf(j, 1, W) {
            cin >> a[i][j];
        }

    f[1][1] = 1LL;

    rf(i, 1, H)
        rf(j, 1, W){
            if(i == 1 && j == 1) continue;
            if(a[i][j] == '.') {

                if(a[i][j - 1] != '#') f[i][j] = (f[i][j] + f[i][j - 1]) % MOD;
                if(a[i - 1][j] != '#') f[i][j] = (f[i][j] + f[i - 1][j]) % MOD;
               // cout << i << " " << j << " " << f[i][j] << endl;
            }
        }
    cout << f[H][W];
    return 0;
}


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

int main(){
    int x, y, z;

    while(1){
        cin >> x >> y;
        if (x == 0 && y == 0) break;

        if (x > y){
            z = x;
            x = y;
            y = z;
        }

        cout << x << " " << y << endl;

    }

    return 0;
}


Measured memory_bytes: 3012
import java.util.Scanner;
public class Main {
	void run(){
		Scanner s = new Scanner(System.in);
		double x1 = s.nextDouble();
		double y1 = s.nextDouble();
		double x2 = s.nextDouble();
		double y2 = s.nextDouble();
		double xLen = (x1-x2)*(x1-x2);
		double yLen = (y1-y2)*(y1-y2);
		double ans = Math.sqrt(xLen + yLen);
		System.out.println(ans);
	}
	public static void main(String args[]){
		new Main().run();
	}
}

Measured memory_bytes: 28056
#include <stdio.h>
 
void degree(int);
int depth(int);
 
typedef struct{
  int parent;
  int left;
  int right;
}Node;
 
Node nodes[100001];
int counter = 0;
 
int main(void) {
 
  int i, j, n, m, new_node, child, left, right;
 
  scanf("%d", &n);
 
  for(i = 0; i < n; i++) {
    nodes[i].parent = -1;
    nodes[i].left = -1;
    nodes[i].right = -1;
  }
 
  for(i = 0; i < n; i++) {
    scanf("%d%d", &new_node, &m);
 
    for(j = 0; j < m; j++) {
      scanf("%d", &child);
      nodes[child].parent = new_node;
      if(j != 0)   nodes[left].right = child;
      else         nodes[new_node].left = child;
      left = child;
 
    }
  }
 
  for(i = 0; i < n; i++) {
    counter = 0;
    printf("node %d: parent = %d, depth = %d, ", i, nodes[i].parent, depth(i));
 
    if(nodes[i].parent == -1)       printf("root, [");
    else if (nodes[i].left == -1)   printf("leaf, [");
    else                            printf("internal node, [");
    
    counter = 0;
    degree(nodes[i].left);
    printf("]\n");
  }
  return 0;
}
 
int depth(int node_num) {
 
  if(nodes[node_num].parent == -1) {
    return counter;
  } else {
    counter++;
    return depth(nodes[node_num].parent);
  }
 
}
 
void degree(int node_num) {
 
  if(node_num != -1) {
 
    if(counter != 0)      printf(", ");
    printf("%d", node_num);
    counter++;
    degree(nodes[node_num].right);
     
  }
}

Measured memory_bytes: 1784
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int n,m,i,j,x,y;
    cin>>n>>m;

    x=min(n,m); y=max(n,m);

    for(i=1;i<=y;i++)
    {
        cout<<x;
    }



    return 0;
}


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

using namespace std;

typedef unsigned long long  ull;

const int N = 10000;
int a[N];

int main(){
	int n;
	while(cin >> n, n){
		ull s = 0, t = 0;
		fill(a, a + N, 61);
		for(int i = 0;i < n;++i){
			cin >> a[i];
		}
		sort(a, a + N);
		for(int i = 0;i < n - 1;++i){
			t += a[i];
			s += t;
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>

int main() {
  size_t N, M, Q;
  scanf("%zu %zu %zu", &N, &M, &Q);

  std::vector<std::vector<size_t>> interval(N+1);
  for (size_t i=0; i<M; ++i) {
    size_t L, R;
    scanf("%zu %zu", &L, &R);
    interval[L].push_back(R);
  }
  for (size_t i=1; i<=N; ++i)
    std::sort(interval[i].begin(), interval[i].end());

  for (size_t i=0; i<Q; ++i) {
    size_t p, q;
    scanf("%zu %zu", &p, &q);

    int res=0;
    for (size_t j=p; j<=q; ++j) {
      auto it=std::upper_bound(interval[j].begin(), interval[j].end(), q);
      res += it-interval[j].begin();
    }
    printf("%d\n", res);
  }
}


Measured memory_bytes: 3456
#include <bits/stdc++.h> 
 
#define INF (1<<31)//INT_MAX/2
#define MOD 1000000007
 
using ll  = long long;
using ull = unsigned long long;
 
int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;

    std::vector<int> a1(N);
    std::vector<int> a2(N);
    for (int i = 0; i < N; i++) {
        std::cin >> a1[i];
    }
    for (int i = 0; i < N; i++) {
        std::cin >> a2[i];
    }

    int max = 0;
    for (int i = 0; i < N; i++) {
        int temp = 0;
        for (int j = 0; j <= i; j++) {
            temp += a1[j];
        }
        for (int j = i; j < N; j++) {
            temp += a2[j]; 
        }
        if (max < temp) {
            max = temp;
        }
    }

    std::cout << max << std::endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func findSumOfDigits(n int) int {
	sum := 0
	for n > 0 {
		sum += n % 10
		n /= 10
	}
	return sum
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	total := 0
	for i := 0; i <= n; i++ {
		if findSumOfDigits(i) >= a && findSumOfDigits(i) <= b {
			total += i
		}
	}
	fmt.Println(total)
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int N = sc.nextInt();
        int[] A = new int[N+1];
        int now = 0;
        int Bkm = sc.nextInt();
        A[1] = Bkm;
        for(int k=2; k<N;k++){
            int Bk = sc.nextInt();
            A[k] = Math.min(Bkm, Bk);
            Bkm = Bk;
        }
        A[N] = Bkm;
        int sum = 0;
        for(int k=1;k<=N;k++){
            sum += A[k];
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 22996
n=int(input())
s=input()

E=[0 for i in range(n)]
W=[0 for i in range(n)]

cnt=0
for i in range(n):
    W[i]=cnt
    if s[i]=="W":
        cnt+=1

cnt=0   
for i in range(n):
    E[n-1-i]=cnt
    if s[n-1-i]=="E":
        cnt+=1

mini=10**8
for i in range(n):
    mini=min(mini,E[i]+W[i])

print(mini)

Measured memory_bytes: 17872
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

int N;

int solve(string& s, string& t) {
  rep(i, N) s[i] -= '0', t[i] -= '0';
  queue<string> q;
  q.push(s);
  unordered_map<string, int> dist;
  dist[s] = 0;

  while(!q.empty()) {
    auto u = q.front(); q.pop();
    int d = dist[u];
    int idx = 0;
    while(idx < N && u[idx] == t[idx]) idx++;
    if(idx == N) break;
    int diff = (t[idx] - u[idx] + 10) % 10;
    REP(i, idx, N) {
      u[i] = (u[i] + diff) % 10;
      if(dist.find(u) == dist.end()) {
        dist[u] = d + 1;
        q.push(u);
      }
    }
  }
  return dist[t];
}

int main() {
  while(cin >> N && N) {
    string s, t; cin >> s >> t;
    cout << solve(s, t) << endl;
  }
}

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

void cm(char a[] , char b[]);
int max(int a , int b);
int c[N+1][N+1];

int main()
{
	char a[N];
	char b[N];
	int i , n;
	scanf("%d",&n);
	for(i = 1; i <= n; i++)
	{
		scanf("%s%s",a+1,b+1);
		a[0]=b[0]= ' ';
		cm(a,b);
	}
}

int max(int a , int b)
{
	if(a < b)return b;
	else return a;
}

void cm(char  a[]  , char b[])
{
	int i , j;
	int m1,m2;
	m1 = strlen(a)-1;
	m2 = strlen(b)-1;
	int ma = 0;
	for(i=0;i<m1;i++)
	{
		c[0][i]=0;
	}
	for(j=0;j<m2;j++)
	{
		c[0][j]=0;
	}
	for(int i = 1; i <=m1; i++)
	{
		for(int j = 1; j<=m2; j++)
		{
			if(a[i]==b[j])
			{
				c[i][j]=c[i-1][j-1]+1;
			}
			else{
				c[i][j]=max(c[i-1][j],c[i][j-1]);
			}
			ma = max(ma,c[i][j]);
				
		}
	}
	printf("%d\n",ma);
}


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

#define pb push_back

using namespace std;

const int MAXN = 3e4 + 10;

int a[MAXN];

vector<int> adj[MAXN];

bool dfs(int u, int fa = -1) {
	for (int v : adj[u]) {
		if (v != fa && a[v] < a[u] && !dfs(v))
			return true;
	}
	return false;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	for (int i = 1; i < n; ++i) {
		int u, v;
		cin >> u >> v;
		adj[--u].pb(--v);
		adj[v].pb(u);
	}
	for (int i = 0; i < n; i++) {
		if (dfs(i))
			cout << i + 1 << " ";
	}

	return 0;
}

Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#include <iomanip>
#define rep(i,x) for(ll i=0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
    if (a < b)swap(a, b);
    if (a % b == 0) return b;
    else return gcd(b, a % b);
}/*フィボナッチテンプレ
ll memo[50];
ll fibo(ll n) {
    if (memo[n] != 0)return memo[n];
    if (n <= 1)return memo[n] = n;
    else return memo[n] = fibo(n - 1) + fibo(n - 2);
}
*/
bool isp(ll n) {
    bool res = true;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  ll n = A * (N - 2);
  ll m = B * (N - 2);
  if(A>B)cout << "0" << endl;
  else if(N == 1 && B - A != 0)cout << "0" << endl;
  else cout << m - n + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
const char nl = '\n';
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))
ll power(ll x, unsigned int y) {ll res = 1;	while (y > 0) { if (y & 1) res = res*x%mod; y = y>>1; x = x*x;} return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
void solve(){
     ll n,k;cin>>n>>k;
     	ll ar[n];
     	f(i,0,n)cin>>ar[i];
     	ll pre=1;
     	f(i,0,k)pre=pre*ar[i];
     	ll j=0;
     	ll ans=1;
     	f(i,k,n){
     		 ans=ar[i];
     		 pre=ar[j];
     		  j++;
     		 if(ans>pre)cout<<"Yes"<<"\n";
     		 else cout<<"No"<<"\n";
     		 
     	}
     	
}
int main() {
    ios;
	int t=1;
	//cin>>t;
	while(t--)solve();
 
    
}


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

int main() {
	int A, B;
	cin >> A >> B;
	int ans;

	if (A > B) {
		ans = A + A - 1;
	}
	if (A < B) {
		ans = B + B - 1;
	}
	if (A == B) {
		ans = A + B;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, M;
    cin >> N >> M;

    bool table[N][M];
    fill(table[0], table[N], false);

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

        for (int j = 0; j < cnt; j++) {
            int a;
            cin >> a;
            a--;
            table[i][a] = true;
        }
    }

    int ret = 0;

    for (int j = 0; j < M; j++) {
        int tmp = 0;

        for (int i = 0; i < N; i++) {
            if (table[i][j]) tmp++;
        }

        if (tmp == N) ret++;
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    long long N, A[100001], B[100001], i, count=0;
    
    cin >> N;
    
    for(i=1; i<=N+1; i++){
	cin >> A[i];
    }

    for(i=1; i<=N; i++){
	cin >> B[i];
    }
    
    for(i=1; i<=N; i++){
	if(A[i] < B[i]){
	    B[i] -= A[i];
	    count += A[i];
	}
	else{
	    count += B[i];
	    B[i] -= B[i];
	}

	if(A[i+1] < B[i]){
	    count += A[i+1];
	    A[i+1] -= A[i+1];
	}
	else{
	    count += B[i];
	    A[i+1] -= B[i];
	}
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        int sum = 0;
        int sum2 = 0;
        String str = sc.next();
        char[] c = str.toCharArray();
        for (int i = 0; i < c.length; i++) {
            int p1 = i % 2 == 0 ? 1 : 0;
            int p2 = i % 2 == 0 ? 0 : 1;
            int s = c[i] == 48 ? 0 : 1;
            sum += p1 ^ s;
//            System.out.println(p1 + ":" + s + ":" + (p1 ^ s));
            sum2 += p2 ^ s;
        }
        System.out.println(Math.min(sum, sum2));
    }
}


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

using namespace std;

int main()
{
	string s, P;
	cin >> s >> P;

	string ss = s + s;
	if ((int)(ss.find(P)) >= 0)
		cout << "Yes" <<endl;
	else
		cout << "No" << endl;

	return 0;
}



Measured memory_bytes: 3196
n,m=map(int,input().split())
MOD=10**9+7
ans = 1
if abs(n-m) > 1:
  print(0)
  exit()
else:
  if abs(n-m) == 0:
    for i in range(1,n+1):
      ans = ans*i%MOD
    for i in range(1,m+1):
      ans = ans*i%MOD
    ans = ans*2%MOD
  else:
    for i in range(1,n+1):
      ans = ans*i%MOD
    for i in range(1,m+1):
      ans = ans*i%MOD
print(ans)
    


Measured memory_bytes: 9116
/*
    Author: Jerry Yang C.H. (tico88612)
    Date: 2019/12/20
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

/********** Good Luck :) **********/
int main()
{
    IOS();
    ll N;
    cin >> N;
    ll a = 1, b = 1;
    while(N--){
        ll s, d;
        cin >> s >> d;
        ll maxx = max(a / s + ((a % s) ? 1 : 0), b / d + ((b % d) ? 1 : 0));
        a = maxx * s;
        b = maxx * d;
    }
    cout << (ll)(a + b) << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int n;
int i=0;
double a[4100][2];

void kc(double xa,double xb,double ya,double yb,int n)
{
    if(n==0)
    {
        if(i==0)
        {
            a[i][0]=xa;
            a[i][1]=ya;
            i+=1;
            a[i][0]=xb;
            a[i][1]=yb;
        }
        else
        {
            i+=1;
            a[i][0]=xb;
            a[i][1]=yb;
        }
        return;
    }
    else
    {
        double x1,x2,x3;
        double y1,y2,y3;
        x1=(xa*2)/3+xb/3;
        x2=((xb-xa)-(yb-ya)*sqrt(3))/6+x1;
        x3=(xb*2)/3+xa/3;
        y1=(ya*2)/3+yb/3;
        y2=((yb-ya)+(xb-xa)*sqrt(3))/6+y1;
        y3=(yb*2)/3+ya/3;

        kc(xa,x1,ya,y1,n-1);
        kc(x1,x2,y1,y2,n-1);
        kc(x2,x3,y2,y3,n-1);
        kc(x3,xb,y3,yb,n-1);
    }
}

int main()
{
    cin >> n;
    kc(0,100,0,0,n);
    cout.setf(ios::fixed);
    cout << setprecision(8) << a[0][0] << ' ' << a[0][1] << endl;
    for(int j=1;;j++) 
    {
        if(a[j][0]==0&&a[j][1]==0)
        {
            break;
        }
        else
        {
            cout << a[j][0] << ' ' << a[j][1] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3340
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    min_ = min(b[i], a[i])
    ans += min_
    b[i] -= min_
    a[i] -= min_
    
    min_ = min(b[i], a[i + 1])
    ans += min_
    b[i] -= min_
    a[i + 1] -= min_
print(ans)

Measured memory_bytes: 82148
fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let s: Vec<char> = iter.next().unwrap().chars().collect();
    let k: u64 = iter.next().unwrap().parse().unwrap();
    
    let mut c = '1';
    for i in 0..(std::cmp::min(100, k) as usize) {
        if s[i] != '1' {
            c = s[i];
            break;
        }
    }
    println!("{}", c);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void){
    
    int N;
    int ans = 0;
    cin >> N;
    vector<int> P(N);
    for(int i = 0; i < N; i++){
        cin >> P.at(i);
    }
    
    for(int i = 1; i < N-1; i++){
        if(P.at(i) < P.at(i-1) && P.at(i) > P.at(i+1)) ans++;
        if(P.at(i) > P.at(i-1) && P.at(i) < P.at(i+1)) ans++;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b;
  while(cin >> a >> b&&a||b){
    int cnt=0;
    for(int i=1;i<=a;i++){
      for(int j=i+1;j<=a;j++){
    for(int k=j+1;k<=a;k++){
      if(i+j+k==b)cnt++;
    }
      }
    }
    cout << cnt << endl;
  }
}


Measured memory_bytes: 3092
#include <stdio.h>
#define MAX(a,b) ((a)>(b)?(a):(b))
#define ll long long
int ary[100001];
 int main(void)
 {
 	int n,x;
 	ll res=0;
 	scanf("%d %d",&n,&x);
 	for(int i=1;i<=n;i++){
 		scanf("%d",&ary[i]);
 		int p=MAX(0,ary[i-1]+ary[i]-x);
 		res+=p,ary[i]-=p;
 	}
 	printf("%lld",res);
 	return 0;
 }

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
ll digits(ll x){
  ll length = 0;
  while (x > 0){
    x /= 10;
    length++;
  }
  return length;
  if (x == 0) return 0;
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
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;
}

int main(){
  cout << fixed << setprecision(15);

  ll n; cin >> n;

  ll ans = 0;
  //string ans;

  ll m = n;
  ans = n / 10;
  n /= 10;
  while(n > 0){
    n /= 5;
    ans += n;
  }
  if(m % 2 == 1) ans = 0;

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


Measured memory_bytes: 256
n,k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort(reverse=True)
f.sort()
af = [a[i]*f[i] for i in range(n)]
lower = 0
upper = max(af)
prev = 0
now = upper // 2
while now != prev:
  count = 0
  for i in range(n):
    if a[i]*f[i] > now:
      count += a[i] - now // f[i]
  if count <= k:
    upper = now
  else:
    lower = now
  prev = now
  now = (lower + upper) // 2

print(upper)

Measured memory_bytes: 119756
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-29 23:28:31
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#else
#define debug(_) 1728
#endif

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

  int n, k; cin >> n >> k;
  int r, s, p; cin >> r >> s >> p;
  string t; cin >> t;

  int ans = 0;

  string hand = "";

  for (int i = 0; i < n; ++i) {
    if (i < k) {
      if (t[i] == 'r') {
        ans += p;
        hand += 'p';
      } else if (t[i] == 's') {
        ans += r;
        hand += 'r';
      } else {
        ans += s;
        hand += 's';
      }
    } else {
      if (t[i] == 'r') {
        if (hand[i - k] != 'p') {
          ans += p;
          hand += 'p';
        } else {
          hand += '$';
        }
      } else if (t[i] == 's') {
        if (hand[i - k] != 'r') {
          ans += r;
          hand += 'r';
        } else {
          hand += '$';
        } 
      } else {
        if (hand[i - k] != 's') {
          ans += s;
          hand += 's';
        } else {
          hand += '$';
        }
      }
    }
    debug(ans);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    cout.precision(9);
    int N, K;
    cin >> N >> K;
    vector<double> p(N, 0);
    double temp = 0;
    rep(i, N) {
        cin >> temp;
        p[i] = (temp / (double)2.) + 0.5;
    }
    double ans = 0;
    rep(i, K) ans += p[i];
    if (N == K) {
        cout << ans << endl;
    }
    else {
        double maxi = ans;
        rept(i, K, N) {
            ans += (p[i] - p[i-K]);
            maxi = max(maxi, ans);
        }
        cout << maxi << endl;
    }


	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdlib>

using namespace std;

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A+B>=C)  cout << "Yes" << endl;
  else  cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
//35
#include<iostream>
#include<complex>

using namespace std;

typedef complex<double> P;

int main(){
  for(;;){
    P p[4];
    for(int i=0;i<4;i++){
      double x,y;
      if(!((cin>>x).ignore()>>y).ignore())return 0;
      p[i]=P(x,y);
    }
    bool a[2]={};
    for(int i=0;i<4;i++){
      P c=p[i]-p[(i+1)%4],d=p[(i+1)%4]-p[(i+2)%4];
      a[c.real()*d.imag()-c.imag()*d.real()>0]|=true;
    }
    cout<<((a[0]&a[1])?"NO":"YES")<<endl;
  }
  return 0;
}

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

int main(){
    string S;
    cin >> S;
    int ans = 7;
    if(S=="SUN"){
        ans = 7;
    }else if(S=="MON"){
        ans = 6;
    }else if(S=="TUE"){
        ans = 5;
    }else if(S=="WED"){
        ans = 4;
    }else if(S=="THU"){
        ans = 3;
    }else if(S=="FRI"){
        ans = 2;
    }else if(S=="SAT"){
        ans = 1;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int a, b, item, count; cin>>a>>b;
	if(b==1){
		cout<<0;
		return 0;
	}
	item=1; count=a;
	
	while(count<b){
		item++;
		count+=a-1;
	}
	
	cout<<item;
	return 0;
}

Measured memory_bytes: 256