akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    string s;
    cin >> s;
    int n = s.length();
    reverse(s.begin(), s.end());
    vector<int> S(n + 1);
    S[0] = 0;
    int mul = 1;
    constexpr int m = 2019;
    for(int i = 0; i < n; ++i){
        int x = s[i] - '0';
        x = x * mul % m;
        mul = mul * 10 % m;
        S[i + 1] = (S[i] + x) % m;
    }
    vector<int> c(m, 0);
    ll ans = 0;
    for(int i = 0; i <= n; ++i){
        ans += c[S[i]];
        ++c[S[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 4424
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;
void init();
#define REP(var, num) for(sll var = 0; var < num; var++)
typedef signed long long sll;
typedef unsigned long long ull;
/*
numeric_limits<sll>::max()
*/

sll bs[20];
int main() {
    init();
    sll n, m, c;
    cin >> n >> m >> c;
    REP(i, m) { cin >> bs[i]; }
    sll res = 0;
    REP(i, n) {
        sll sum = c;
        REP(i, m) {
            sll a;
            cin >> a;
            sum += a * bs[i];
        }

        if (sum > 0) {
            res++;
        }
    }

    cout << res << endl;
    return 0;
}

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
if a<c:
    if b<c:
        print(0)
    else:
        if b<d:
            print(b-c)
        else:
            print(d-c)
else:
    if a<d:
        if d<b:
            print(d-a)
        else:
            print(b-a)
    else:
        print(0)

Measured memory_bytes: 38384
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

int main()
{
    int x1,x2,x3,x4,y1,y2,y3,y4;
    int dx, dy;
    std::cin >> x1 >> y1 >> x2 >> y2;
    dx = x2 - x1;
    dy = y2 - y1;
    x3 = x2 - dy;
    y3 = y2 + dx;
    x4 = x3 - dx;
    y4 = y3 - dy;
    std::cout << x3 << " " << y3 << " " << x4 << " " << y4 << std::endl;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f(s):
        return ord(s)-ord("A")
    n,a,b,c = LI()
    l = [a,b,c]
    ans = []
    s = [list(map(f, input())) for i in range(n)]
    for i in range(n):
        si = s[i]
        si.sort()
        if l[si[0]] == l[si[1]] == 0:
            print("No")
            return
        if l[si[0]] == l[si[1]] == 1 and min(l) == 0 and i+1 < n:
            nsi = s[i+1]
            nsi.sort()
            if nsi == si:
                if l[si[0]] < l[si[1]]:
                    l[si[0]] += 1
                    l[si[1]] -= 1
                    ans.append(chr(si[0]+ord("A")))
                else:
                    l[si[1]] += 1
                    l[si[0]] -= 1
                    ans.append(chr(si[1]+ord("A")))
            else:
                k = [0]*3
                for i in si+nsi:
                    k[i] += 1
                    if k[i] == 2:
                        break
                l[i] += 1
                for j in si:
                    if j != i:
                        break
                l[j] -= 1
                ans.append(chr(i+ord("A")))
        elif l[si[0]] < l[si[1]]:
            l[si[0]] += 1
            l[si[1]] -= 1
            ans.append(chr(si[0]+ord("A")))
        else:
            l[si[1]] += 1
            l[si[0]] -= 1
            ans.append(chr(si[1]+ord("A")))
    print("Yes")
    for i in ans:
        print(i)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 97940
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する

void solve(int n,int p){
    vector<int> v(n);
    int one = p;
    int cur = 0;
    while(true){
        if(one == 0){
            one = v[cur];
            v[cur] = 0;
        }else{
            one--;
            v[cur]++;
        }
        if(one == 0 && v[cur] == p){
            cout << cur << endl;
            return;
        }
        cur++;
        cur %= n;
    }
}

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

    while(true){
        int n,p;
        cin >> n >> p;
        if(n == 0) break;
        solve(n,p);
    }


    return 0;
}



Measured memory_bytes: 3120
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scan=new Scanner(System.in);
		String A=scan.next();
		String B=scan.next();
		String C=scan.next();
		int ac=0,bc=0,cc=0,c=0;
		for(;;) {
			if(c==0) {
				ac++;
				if(ac==A.length()+1) {
					System.out.println("A");
					break;
				}
				switch(A.charAt(ac-1)) {
				case 'a':c=0;break;
				case 'b':c=1;break;
				case 'c':c=2;break;
				}
			}if(c==1) {
				bc++;
				if(bc==B.length()+1) {
					System.out.println("B");
					break;
				}
				switch(B.charAt(bc-1)) {
				case 'a':c=0;break;
				case 'b':c=1;break;
				case 'c':c=2;break;
				}
			}if(c==2) {
				cc++;
				if(cc==C.length()+1) {
					System.out.println("C");
					break;
				}
				switch(C.charAt(cc-1)) {
				case 'a':c=0;break;
				case 'b':c=1;break;
				case 'c':c=2;break;
				}
			}
		}
	}
}


Measured memory_bytes: 23636
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("[DEBUG] ");W(__VA_ARGS__);}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1<<20;
void solve() {
    int n;
    R(n);
    string s;
    R(s);
    int w_cnt=0;
    REP(i,n){
        w_cnt+=(s[i]=='W');
    }
    int r_cnt=(n-w_cnt);
    int an=r_cnt;
    int ll=0;
    REP(i,n){
        if(s[i]=='W')ll++;
        else r_cnt--;
        an=min(an,max(ll,r_cnt));
    }
    W(an);
}
int main(){
#define MULTITEST 0
#if MULTITEST    
    CASET{
        solve();
    }
#else
    solve();
#endif
    return 0;
}


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

int main() {
	ll n;
	cin >> n;
	set<string> ans;
	for (ll i = 0; i < n; ++i) {
		string s;
		cin >> s;
		ans.insert(s);
	}
	cout << ans.size() << endl;
}

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

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題167

            int X = int.Parse(Console.ReadLine());

            X = 8 - (X - 400) / 200;

            Console.WriteLine(X);
        }


    }
}


Measured memory_bytes: 27536
import java.util.*;class Main{public static void main(String[] q){Scanner c=new Scanner(System.in);for(;;){int n=c.nextInt(),s=c.nextInt();if(n==0&&s==0)break;System.out.println(f(0,0,s,n));}}static int f(int x,int a,int t,int n){return n==0?x==t?1:0:a>9?0:f(x+a,a+1,t,n-1)+f(x,a+1,t,n);}}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<pair<ll,ll>>data(n);
    rep(i,n)cin >> data[i].first >> data[i].second;
    sort(all(data));
    int cnt = 0;
    int s = 0;
    ll ans = 0;
    while(1){
        if(m-cnt <= data[s].second){
            ans += data[s].first * (m-cnt);
            break;
        }
        ans += data[s].first * data[s].second;
        cnt += data[s].second;
        s++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1920
package main

import "fmt"

func main() {
	for {
		var m, f, r int
		fmt.Scan(&m, &f, &r)
		if m == -1 && f == -1 && r == -1 {
			break
		}
		t := m + f
		g := ""
		if m == -1 || f == -1 || t < 30 {
			g = "F"
		} else if t >= 80 {
			g = "A"
		} else if t >= 65 {
			g = "B"
		} else if t >= 50 {
			g = "C"
		} else if t >= 30 {
			if r >= 50 {
				g = "C"
			} else {
				g = "D"
			}
		}
		fmt.Println(g)
	}
}



Measured memory_bytes: 1120
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;


int main() {
  int n;
  cin >> n ;
  ll ans = 1;
  for(int i=1; i<=n; i++){
    ans *= i;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}  


Measured memory_bytes: 256
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n): return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop

n=n0()
h=n1()

c=h[n-1]
f=True
for i in range(n-2,-1,-1):
    if c>h[i]:
        c=h[i]
    elif c+1>=h[i]:
        continue
    else:
        f=False
        break
    
p0(f)
    

Measured memory_bytes: 14704
import sys

sys.setrecursionlimit(10**7)


def dfs(x):
    if arrival[x-1]==1:
        return
    else:
        arrival[x-1]=1
        for i in mapi[x-1]:
            dfs(i)
        return

n,m=map(int,input().split())

l=[]
for i in range(m):
    l.append(list(map(int,input().split())))

count=0
for i in range(m):
    li=l[0:i]+l[i+1:m]
    mapi=[[] for a in range(n)]
    for j in range(m-1):
        mapi[li[j][0]-1].append(li[j][1])
        mapi[li[j][1]-1].append(li[j][0])
    arrival=[0 for a in range(n)]
    dfs(1)
    if 0 in arrival:
        count+=1
print(count)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int a = scn.nextInt();
        int b = scn.nextInt();

        int d = a / b;

        int r = a % b;

        double f = a / (double)b;

        //System.out.println(d + " " + r + " " + f);

        System.out.printf("%d %d %.10f\n", d, r, f);


    }
}


Measured memory_bytes: 26556
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string S;
    cin >> S;
    int up = 0, down = 0, l = 0, r = 0;
    for(char c : S){
        if(c == 'N') ++up;
        else if(c == 'S') ++down;
        else if(c == 'W') ++l;
        else ++r;
    }
    if((up == 0 && down != 0) || (up != 0 && down == 0) || (l == 0 && r != 0) || (l != 0 && r == 0)) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();
        //int num[] = new int[3];
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        //boolean flag = true;
        
        if(a == 2 || b == 2){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
        
        
        //System.out.println();
        //System.out.print();
    }
}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

char direc[4] = {'U','R','D','L'};

int main(){
    ll a,b,c,d; cin >> a >> b >> c >> d;
    ll x = c-a;
    ll y = d-b;
    ll dx = (x < 0) ? 2 : 0;
    ll dy = (y < 0) ? 2 : 0;
    rep(i,abs(y)) cout << direc[0+dy];
    rep(i,abs(x)) cout << direc[1+dx];
    rep(i,abs(y)) cout << direc[(2+dy)%4];
    rep(i,abs(x)) cout << direc[(3+dx)%4];
    cout << direc[(3+dx)%4];
    rep(i,abs(y)+1) cout << direc[0+dy];
    rep(i,abs(x)+1) cout << direc[1+dx];
    cout << direc[(2+dy)%4];
    cout << direc[1+dx];
    rep(i,abs(y)+1) cout << direc[(2+dy)%4];
    rep(i,abs(x)+1) cout << direc[(3+dx)%4];
    cout << direc[0+dy] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string x = "";
  int N;
  cin>>N;
  if (N==0) cout<<0<<endl;
  else{
    while (N!=0){
      int k = N%(-2);
      N/= (-2);
      if (k<0){
        k = abs(k);
        N++;
      }
      x += to_string(k);
    }
    reverse(x.begin(),x.end());
    cout<<x<<endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	string S; cin >> S;
	ll K; cin >> K;
	int i = 0;
	while (S[i] == '1' && i < (int)S.length()) i++;
	if (i == S.length()) cout << S[i - 1] << endl;
	else if (i < K) cout << S[i] << endl;
	else cout << 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

int main() {
    int x;
    cin >> x;
    vector<bool> dp(1001, false);
    dp[1] = true;
    for (auto i = 2; i * i < 1001; i++) {
        int v = i * i;
        while (v < 1001) {
            dp[v] = true;
            cerr << v << endl;
            v *= i;
        }
    }
    for (auto i = x; i >= 0; i--) {
        if (dp[i]) {
            cout << i << endl;
            return 0;
        }
    }
}



Measured memory_bytes: 256
#5B-can you solve this
N, M, C = map(int, input().split())
listB = list(map(int, input().split()))
cnt = 0

for i in range(N):
    sum = 0
    listA = list(map(int, input().split()))
    for j in range(M):
        sum += listA[j] * listB[j]
    if sum + C > 0:
        cnt += 1

print (cnt)

Measured memory_bytes: 9180
package main

import (
	"fmt"
)

func main() {
	rev := false
	s1 := make([]rune, 300000)
	s2 := make([]rune, 200000)

	var s string
	fmt.Scanf("%s", &s)
	r := []rune(s)
	for i := 0; i < len(r); i++ {
		s1[i] = r[i]
	}
	len1, len2 := len(s), 0

	var Q int
	fmt.Scanf("%d", &Q)
	for Q > 0 {
		Q--
		var t int
		fmt.Scanf("%d", &t)
		if t == 1 {
			rev = !rev
			continue
		}
		var f int
		var c string
		fmt.Scanf("%d %s", &f, &c)
		if (f == 1 && rev) || (f == 2 && !rev) {
			s1[len1] = []rune(c)[0]
			len1++
		} else {
			s2[len2] = []rune(c)[0]
			len2++
		}
	}
	s1 = s1[:len1]
	s2 = s2[:len2]
	if rev {
		s1, s2 = s2, s1
	}
	fmt.Printf("%s\n", string(append(reverse(s2), s1...)))
}

func reverse(s []rune) []rune {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}


Measured memory_bytes: 6784
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using namespace std;

int main() {
	string s;
	cin >> s;
	int v = 700;
	for (int i = 0; i < 3; i++) {
		if (s[i] == 'o') {
			v += 100;
		}
	}
	cout << v;
}







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

int main(void)
{
	ios_base::sync_with_stdio(0);
	double n, k;
	cin >> n >> k;
	double ans = 0;
	for(int i = 1; i <= (int) n; i++) {
                int step = 0;
                int z = i;
                while(z < k) {
                        step++;
                        z = z * 2;
                }
                ans = ans + (1.0 / n) * pow(0.5, step);
	}
	cout << fixed << setprecision(12) << ans;
	return 0;
}


Measured memory_bytes: 256
a=0
b=0
s=list(map(int, input().split()))
if s[0]==s[1]:
    print(2*s[0])
    b=1
elif s[0]>s[1]:
    a=s[0]
    s[0]=s[0]-1
else:
    a=s[1]
    s[1]=s[1]-1
if s[0]==s[1]:
    a=a+s[0]
elif s[0]>s[1]:
    a=a+s[0]
else:
    a=a+s[1]
if b==0:
    print(a)

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

using namespace std;
typedef pair<int,int> P;
int D[440];
int n,m,x,y,cost,Time;
vector<P> matrix1[440],matrix2[440];

void djkstra1(int s){ 
  priority_queue<P,vector<P>,greater<P> > que;
  for(int i=0;i<m+2;i++)D[i] = 10000000;
  D[s] = 0;
  que.push(P(s,0));
  while(!que.empty() ){
    P p = que.top();que.pop();
    int v = p.first;
    if(D[v] < p.second)continue;
    for(int i=0;i<matrix1[v].size();i++){
      P pp = matrix1[v][i];
      if(D[pp.first] > D[v] + pp.second){
	D[pp.first] = D[v] + pp.second;
	que.push(P(pp.first,D[pp.first]));
      }
    }
  }
}

void djkstra2(int s){ 
  priority_queue<P,vector<P>,greater<P> > que;
  for(int i=0;i<m+2;i++)D[i] = 10000000;
  D[s] = 0;
  que.push(P(s,0));

  while(!que.empty() ){
    P p = que.top();que.pop();
    int v = p.first;
    if(D[v] < p.second)continue;
    for(int i=0;i<matrix2[v].size();i++){
      P pp = matrix2[v][i];
      if(D[pp.first] > D[v] + pp.second){
	D[pp.first] = D[v] + pp.second;
	que.push(P(pp.first,D[pp.first]));
      }
    }
  }
}



int main(){
  int p,q,r;
  while(true){
    cin >> n >> m;
    if(n+m == 0)break;
   
    for(int i=0;i<=m ;i++){
      matrix1[i].clear();
      matrix2[i].clear();
    }
    for(int i=0;i<n;i++){
      cin >> x >> y >> cost >> Time;
      matrix1[x].push_back(P(y,cost));
      matrix2[x].push_back(P(y,Time));
      matrix1[y].push_back(P(x,cost));
      matrix2[y].push_back(P(x,Time));
    }  

    int k;
    cin >> k;
    for(int i=0;i<k;i++){
      cin >> p >> q >> r;
      if(r == 0){
	djkstra1(p);
	cout << D[q] << endl;
      }
      else{
	djkstra2(p);
	cout << D[q] << endl;
      }

    }

  }
  return 0;
}

Measured memory_bytes: 1340
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func max(a int, b int) int {
	if a >= b {
		return a
	}
	return b
}

type Node struct {
	Index     int
	Value     int
	Neighbors []*Node
	Len       int
	IsSearched  bool
}

var nodes []*Node
var already map[int]bool

var N, A, B, C int
var s []string
var roads []rune

func search(depth int) bool {
	//fmt.Printf("depth: %d, A:  %d, B: %d, C: %d, roads: %s\n", depth, A, B, C, string(roads))
	if depth == N {
		return true
	}
	var first, second *int
	runes := make([]rune, 2)
	switch s[depth] {
	case "AB":
		first = &A
		second = &B
		runes[0] = 'A'
		runes[1] = 'B'
	case "AC":
		first = &A
		second = &C
		runes[0] = 'A'
		runes[1] = 'C'
	case "BC":
		first = &B
		second = &C
		runes[0] = 'B'
		runes[1] = 'C'
	default:
		panic(s[depth])
	}
	if *first == 0 && *second == 0 {
		return false
	}
	if *first == 0 {
		*first++
		*second--
		roads[depth] = runes[0]
		return search(depth + 1)
	}
	if *second == 0 {
		*first--
		*second++
		roads[depth] = runes[1]
		return search(depth + 1)
	}
	// 試す
	*first++
	*second--
	roads[depth] = runes[0]
	if search(depth + 1) {
		return true
	} else {
		*first--
		*first--
		*second++
		*second++
		roads[depth] = runes[1]
		return search(depth + 1)
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	nextInt(&N, &A, &B, &C)
	s = make([]string, N)
	for i := 0; i < N; i++ {
		s[i] = nextLine()
	}
	//fmt.Printf("%v", s)

	roads = make([]rune, N)
	if search(0) {
		fmt.Printf("Yes\n")
		for i := 0; i < N; i++ {
			fmt.Println(string(roads[i]))
		}
	} else {
		fmt.Printf("No\n")
	}
}




const MAX_INT int = 1_000_000_000
var sc = bufio.NewScanner(os.Stdin)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)

func nextLine() string {
	buffer := make([]byte, 0)
	for true {
		line, isPrefix, err := reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func nextInt(A ...*int) {
	L := strings.Split(nextLine(), " ")
	for i, a := range A {
		*a, _ = strconv.Atoi(L[i])
	}
}
func nextInts(A *[]int) {
	L := strings.Split(nextLine(), " ")
	(*A) = make([]int, len(L))
	for i, l := range L {
		(*A)[i], _ = strconv.Atoi(l)
	}
}

func nextInt64(A ...*int64) {
	L := strings.Split(nextLine(), " ")
	for i, a := range A {
		*a, _ = strconv.ParseInt(L[i], 0, 64)
	}
}


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

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

    ll N, M;
    cin >> N >> M;

    ll x = 100 * (N - M) + 1900 * M;

    cout << pow(2, M) * x << endl;
}

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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for (int i=a; i<b; i++)
#define M00(i, a) for (int i=0; i<a; i++)
#define MOOd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define M00d(i,a) for (int i = (a)-1; i >= 0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _<< " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef vector<ll,ll> vll;
typedef pair<ll,ll> pll;

const ll MOD = 1e9 + 7;
const ll N = 100;
const ll K = 100100;

//n is 0-indexed, k is how many candies, can be 0;
//stores number of ways to assign 0-k candies to first n kids
ll DP[N][K];

int main() { FAST
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int n, k;
	cin >> n >> k;
	vector<ll> a(n);
	M00(i, n) cin >> a[i];

	M00(i, k + 1) {
		if(i <= a[0])
			DP[0][i] = i+1;
		else
			DP[0][i] = a[0]+1;
	}

	MOO(i, 1, n) {
		M00(j, k+1) {
			if(j == 0) DP[i][j] = 1;
			else {
				DP[i][j] = DP[i][j-1];
				DP[i][j] += DP[i-1][j];
				if(j -1 >= a[i])
					DP[i][j] -= DP[i-1][j-1-a[i]];
			}
			DP[i][j] %= MOD;
			DP[i][j] += MOD;
			DP[i][j] += MOD;
			DP[i][j] %= MOD;
		}
	}
	if(k == 0) {
		finish(1);
	}
	else {
		ll ans = DP[n-1][k] - DP[n-1][k-1];
		ans %= MOD;
		ans += MOD;
		ans %= MOD;
		cout << ans << endl;
	}
}


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

using namespace std;


int main() {
	
	int L[4];

	for (int i = 0; i < 4; i++)
		cin >> L[i];

	sort(L, L + 4);

	if (L[0] == L[1] && L[2] == L[3])
		cout << "yes\n";

	else
		cout << "no\n";

	return 0;

}







Measured memory_bytes: 3144
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long
#define pb push_back

int n, a;
unordered_set <int> s;
int32_t main() {
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> a;
		s.insert(a);
	}
	if (s.size() == n) {
		cout << "YES";
	}
	else cout << "NO";
}

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

int main(){
  
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if( (0 <= a-c && a-c <= d) || (0 <= c-a && c-a <= d) ){  
    
  cout << "Yes" << endl; 

  }

  else if( (0 <= b-a && b-a <= d) && (0 <= b-c && b-c <= d) ){
    
  cout << "Yes" << endl;  
    
  }
 
  else if( (0 <= b-a && b-a <= d) && (0 <= c-b && c-b <= d) ){
    
  cout << "Yes" << endl;  
    
  }  
  
  else if( (0 <= a-b && a-b <= d) && (0 <= b-c && b-c <= d) ){
    
  cout << "Yes" << endl;  
    
  }
          
  else if( (0 <= a-b && a-b <= d) && (0 <= c-b && c-b <= d) ){
                                      
  cout << "Yes" << endl;  
    
  }
          
  
  else{
    
  cout << "No" << endl;
    
  }
  
}
  

    


Measured memory_bytes: 384
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<set>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
#define P pair<int,int>
#define F first
#define S second
 
using namespace std;

int main(){
  vector<string> name(3);
  Srep(3) cin >> name[i];
  cout << name[0][0] << name[1][0] << name[2][0] << endl;
}

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

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

int MOD = 1e9 + 7;
ll INF = 1e18;

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

int main(){
    int n, q; cin>>n>>q;
    int head=1;

    for(int i=0; i<q; i++){
        int x, y; cin>>x>>y;
        if(x == 0){
            if(y + head <= n + 1){
                cout << head + y - 1 << endl;
            }
            else{
                cout << y + head - (n + 1) << endl;
            }
        }
        else{
            if(y + head <= n){
                head=head+y;
            }
            else{
                head=head+y-n;
            }
        }
        //cout << "head" << head << endl;
    }
}


Measured memory_bytes: 3112
#include <iostream>
#include <queue>

int N, M;
long long ar[1001][3];

int main() {
  std::cin>>N>>M;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < 3; ++j)
      std::cin>>ar[i][j];

  long long ans = 0;
  for (int mask = 0; mask < (1<<3); ++mask) {
    std::priority_queue<long long> pq;
    for (int i = 0; i < N; ++i) {
      long long cur = 0;
      for (int j = 0; j < 3; ++j) {
        if (mask & (1 << j)) {
          cur -= ar[i][j];
        } else
          cur += ar[i][j];
      }
      pq.push(cur);
    }
    long long temp = 0;
    for (int i = 0; i < M; ++i) {
      temp += pq.top();
      pq.pop();
    }
    ans = std::max(ans, temp);
  }
  std::cout<<ans<<'\n';

  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
import copy

def main():
    N,M = map(int,input().split())
    a = list(map(int,input().split()))
    a.sort()
    
    MOD = 10**9+7
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
    invfac = copy.deepcopy(fac)
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    invfac[-1] = pow(fac[-1],MOD-2,MOD)
    for i in range(N,0,-1):
        invfac[i-1] = (invfac[i]*i)%MOD
    
    def coef(x,y):
        num = (((fac[x]*invfac[y])%MOD)*invfac[x-y]%MOD)
        return num
        
    p,m = 0,0
    for i in range(N-M+1):
        comb = coef(N-i-1,M-1)
        p += a[-i-1]*comb
        m += a[i]*comb

    print((p-m)%MOD)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 56560
from operator import itemgetter

# a, b = map(int, input().split())
a = int(input())
array2 = {}
array99 = []
for i in range(a):
    array = input().split()
    array99.append((array[0], int(array[1]) * -1, i))

# print(array99)

b = sorted(array99, key=itemgetter(0, 1))

# print(b)

for i in range(a):
    print(b[i][2] + 1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define FUP(i, a, b) for(int i = a; i <= b; i++)
#define FDOWN(i, a, b) for(int i = a; i >= b; i--)
#define MS(a, b) memset(a, b, sizeof(a))
#define ALL(v) v.begin(), v.end()
#define CIN(a) cin >> a;
#define CIN2(a, b) cin >> a >> b
#define CIN3(a, b, c) cin >> a >> b >> c
#define COUT(a) cout << a
#define COUT2(a, b) cout << a << ' ' << b
#define COUT3(a, b, c) cout << a << ' ' << b << ' ' << c
#define ENDL cout << '\n'
int dy[4] = { -1, 1, 0, 0 };
int dx[4] = { 0, 0, 1, -1 };
#define INF 987654321

int H, W, d[1001][1001];
char arr[1001][1001];
pair<int, int> C, D;

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

	CIN2(H, W);
	CIN2(C.first, C.second);
	CIN2(D.first, D.second);
	FUP(i, 1, H)
	{
		FUP(j, 1, W)
		{
			CIN(arr[i][j]);
			d[i][j] = INF;
		}
	}
	d[C.first][C.second] = 0;
	priority_queue <pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>, greater<pair<int, pair<int, int>>>> pq;
	pq.push({ 0, {C.first, C.second} });
	while (!pq.empty())
	{
		int dis = pq.top().first;
		int y = pq.top().second.first;
		int x = pq.top().second.second;
		pq.pop();
		if (y == D.first && x == D.second) break;
		FUP(i, 0, 3)
		{
			int ny = y + dy[i];
			int nx = x + dx[i];
			if (ny <= 0 || nx <= 0 || ny > H || nx > W || arr[ny][nx] == '#') continue;
			if (d[ny][nx] <= dis) continue;
			d[ny][nx] = dis;
			pq.push({ dis, {ny, nx} });
		}
		FUP(i, -2, 2)
		{
			FUP(j, -2, 2)
			{
				int ny = y + i;
				int nx = x + j;
				if (ny <= 0 || nx <= 0 || ny > H || nx > W || arr[ny][nx] == '#') continue;
				if (d[ny][nx] <= dis + 1) continue;
				d[ny][nx] = dis + 1;
				pq.push({ dis + 1, {ny, nx} });
			}
		}
	}
	d[D.first][D.second] == INF ? COUT(-1) : COUT(d[D.first][D.second]);


	return 0;
}

Measured memory_bytes: 8488
a,b,c,k=map(int,input().split())
a2=b+c
b2=a+c
c2=a+b
if(k%2==0):
    if(a-b<10**18):
        print(a-b)
    else:
        print("Unfair")
else:
    if(a2-b2<10**18):
        print(a2-b2)
    else:
        print("Unfair")
    

Measured memory_bytes: 3316
while True :
    h, w = [int(x) for x in input().split()]
    if h == 0 and w == 0 :
        break
    for i in range(h) :
        if i == 0 or i == h-1 :
            print('#'*w)
        else :
            print('#' + '.'*(w-2) + '#')
    print()


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

int main(){
int n,m;
int cnt = 0,cnt2 = 0,cnt3 = 0;
cin >> n >> m;
vector<int> v2(m);
vector<vector<int>> v(m,vector<int>(n));
    for(int i=0;i<m;i++){
        cin >> v2[i];
        for(int j=0;j<v2[i];j++) cin >> v[i][j];
    } 
    vector<int> v3(m);
    for(int i=0;i<m;i++) cin >> v3[i];
    for(int i=0;i<(1<<n);i++){
        bitset<11> b(i);
        for(int k=0;k<m;k++){
            for(int j=0;j<v2[k];j++){
                if(b[v[k][j]-1] == 1)cnt++;
            }
            if(cnt%2 != v3[k])cnt2++;
            cnt = 0;
        }
        if(cnt2 == 0)cnt3++;
        cnt2 = 0;
    }
    cout << cnt3 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long
int main()
{
    ll t,n,i,j,k,l,m,f,a,b,c,d,s;
    string s1;
    cin>>s1;
    if(s1=="Sunny"){cout<<"Cloudy"<<endl;}
    if(s1=="Cloudy"){cout<<"Rainy"<<endl;}
    if(s1=="Rainy"){cout<<"Sunny"<<endl;}
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,a[51],ans=0;
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)
	  scanf("%d",&a[i]);
	sort(a+1,a+1+n);
	for (int i=n-k+1;i<=n;i++)
	  ans+=a[i];
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
signed main(){
	int n, m;
	cin >> n >> m;
	int ans = min(n, m / 2);
	n -= ans;
	m -= ans * 2;
	if(m < 2){
		cout << ans << endl;
	}else{
		ans += m / 4;
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	X := scanInt()
	Y := scanInt()
	Z := scanInt()
	K := scanInt()
	a := scanInts(X)
	b := scanInts(Y)
	c := scanInts(Z)

	bc := make([]int, Y*Z)
	for i := 0; i < Y; i++ {
		for j := 0; j < Z; j++ {
			bc[Z*i+j] = b[i]+c[j]
		}
	}

	sort.Ints(bc)

	bc = bc[max(Y*Z-K, 0) : Y*Z]
	abc := make([]int, len(bc)*X)

	for i := 0; i < len(bc); i++ {
		for j := 0; j < X; j++ {
			abc[X*i+j] = a[j]+bc[i]
		}
	}

	sort.Ints(abc)

	for i := 0; i < K; i++ {
		fmt.Fprintln(wr, abc[len(abc)-1-i])
	}

}


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

const int Maxn = 200005;

int n, k, c;
char str[Maxn];
bool mark[Maxn];
int dp[Maxn];

int main()
{
    scanf("%d %d %d", &n, &k, &c);
    scanf("%s", str + 1);
    int i = 1;
    int lft = k;
    while (lft > 0)
        if (str[i] == 'x') i++;
        else { mark[i] = true; lft--; i += c + 1; }
    for (int i = n; i > 0; i--) {
        dp[i] = dp[i + 1];
        if (str[i] != 'x') {
            int cand = 1;
            if (i + c + 1 <= n)
                cand += dp[i + c + 1];
            dp[i] = max(dp[i], cand);
        }
    }
    int was = 0;
    for (int i = 1; i <= n; i++) {
        if (mark[i] && was + dp[i + 1] < k) printf("%d\n", i);
        if (mark[i]) was++;
    }
    return 0;
}


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

#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

void solve()
{
  int n; cin>>n;
  vector<int> x(n, 0);
  for (int i=0; i<n; i++) {
    cin>>x[i];
  }
  vector<int> y=x;
  SORT(y);
  int m = y[n/2];
  for (int i=0; i<n; i++) {
    if (x[i]>=m) cout << y[n/2-1] << endl;
    else cout << m << endl;
  }
}

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


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

int main() {
  double A, B, C, D;
  cin >> A >> B >> C >> D;
  int taka, ao;
  double x, y;
  x=A/D;
//  cout << x << endl;
  taka = ceil (x);
//  cout << taka << endl;
  y=C/B;
//  cout << y << endl;
  ao = ceil (y);
//  cout << ao << endl;
  if (taka >= ao)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

using namespace std;
using ll = long long;

int main() {
  int s, w;
  cin >> s >> w;
  if (s <= w) {
    cout << "unsafe" << endl;
  } else {
    cout << "safe" << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;

const ll mod = 1000000007;

ll dp[200005];
int lastc[200005], N, X;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> N;
	dp[0] = 1;
	for (int i = 1; i <= N; ++i){
		dp[i] = dp[i-1];
		cin >> X;
		if (lastc[X] != 0 && lastc[X] != i-1){
			dp[i] += dp[lastc[X]];
		}
		lastc[X] = i;
		dp[i] %= mod;
	}
	cout << dp[N] << '\n';
	cout << flush;
	//for (int i = 0; i < 1e9; ++i){for (int j = 0; j < 1e9; ++j){}}
}

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

int main(){
    int d,X,Y,W,H,n,x,y;

    cin >> d;
    while(d--){
        int cnt = 0;
        
        cin >> X >> Y >> W >> H;
        cin >> n;
        while(n--){
            cin >> x >> y;
            
            if((X <= x && x <= X+W)&&(Y <= y && y <= Y+H)) cnt++;
        }
        
        cout << cnt << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  int a,b;cin>>a>>b;
  if(a+b>=10)cout<<"error"<<endl;
  else cout<<a+b<<endl;
  return 0;
}

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

result = []
for i in range(len(b)):
    for j in reversed(list(range(len(b)))):
        if b[j] == j + 1:
            result.append(b.pop(j))
            break
if len(b) != 0:
    print(-1)
    exit(0)

for result_i in reversed(result):
    print(result_i)

Measured memory_bytes: 3060
#include<iostream>
#include<string.h>
#include<string>
#include<algorithm>
#include<stack>
#include<vector>
using namespace std;
const int INF =  0x3f3f3f;
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define rep(i,n) for( i = 0; i < n; i++)
#define rep2(i,n) for(i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> vctp;
vctp vt;
const int N = 100000+900;
int vis[N] = {0};
int ranks[N] = {0};
int size[N] = {0};
ll Find(ll n){
		if(vis[n] == n){
			return n;
		}
		return vis[n] = Find(vis[n]);
}
void Unit(ll a, ll b){
		ll x = Find(a);
		ll y = Find(b);
		if(x == y) return ;
		if(ranks[x] > ranks[y]){
			vis[y] = x;
			size[x] += size[y];
		}else{
				if(ranks[x] == ranks[y]) ranks[y]++;
				vis[x] = y;
				size[y] += size[x];
		}
}
int main(){
    CloseIo;
    ll n,m,quest;
		cin>>n>>m;
		fill(size,size+N+1,1);
		ll i;
		rep(i,n) vis[i] = i;
		ll sum = 0;
		sum = n*(n-1)/2;
		vector<ll> vc;
		vc.push_back(sum);
		rep(i,m){
			ll x,y;
			cin>>x>>y;
			vt.push_back(make_pair(x,y));
		}
		rep2(i,m){
			if(Find(vt[i].first) != Find(vt[i].second)){
				sum -= size[Find(vt[i].first)]*size[Find(vt[i].second)];
			}
			Unit(vt[i].first,vt[i].second);
			vc.push_back(sum);
		}
		rep2(i,m){
			cout<<vc[i]<<endl;
		}
}


Measured memory_bytes: 5872
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int x,y,z;
int V[4];
int E[51];
int A[51];
double memo[51][5001];
double f(int u,int c)
{
	if(u>=y)return c;
	if(memo[u][c]>=0)return memo[u][c];
	double sum=0;
	for(int i=0;i<x;i++)
	{
		int v=u+V[i];
		if(v>y)
		{
			sum+=c;
			continue;
		}
		if(E[v]==0)sum+=f(v,c);
		else if(E[v]==1)sum+=f(v+A[v],c);
		else if(E[v]==2)sum+=f(v,c+A[v]);
		else if(E[v]==3)sum+=f(v,max(c-A[v],0));
	}
	return memo[u][c]=sum/x;
}
main()
{
	while(cin>>x>>y>>z,x)
	{
		for(int i=0;i<x;i++)cin>>V[i];
		for(int i=0;i++<y;)E[i]=A[i]=0;
		for(int i=0;i<z;i++)
		{
			int n;cin>>n;
			cin>>E[n]>>A[n];
		}
		for(int i=0;i<=y;i++)for(int j=0;j<=5000;j++)memo[i][j]=-1;
		cout<<floor(f(0,0))<<endl;
	}
}



Measured memory_bytes: 5176
#include<cstdio>
#include <algorithm>
using namespace std;
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int now=1;
	for(int i=1;i<=n;i++)
	{
		if(now<k)
		{
			now*=2;
		}
		else
			now+=k;
	}
	printf("%d",now);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n;

        cin>>n;
       // if(n==0)break;
        bool f=true;
        stack<int> v;

        rep(i,n) {
            string c;
            cin >> c;
            if (c[0] == 'A') {
                v.push(0);
            } else {
                if (v.empty()) {

                    f = false;
                    break;
                } else {
                    v.pop();
                }
            }

        }

        if(!v.empty())f=false;


        if(f)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

    

    return 0;
}



Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, i, j, k, ans, a, b, c, d, es;
	string s, ss = "MARCH";
	cin >> n;
	vector<long long> ct(26, 0);
	for (i = 0; i < n; i++) {
		cin >> s;
		ct[s[0] - 'A']++;
	}

	ans = 0;
	for (i = 0; i < 5; i++) {
		for (j = i + 1; j < 5; j++) {
			for (k = j + 1; k < 5; k++)
				ans += ct[ss[i] - 'A'] * ct[ss[j] - 'A'] * ct[ss[k] - 'A'];
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef pair<int,P> Pii;
typedef long long int ll;
typedef pair<ll,ll> LLP;
int dx[6] = {1,0,0,-1,1,-1};
int dy[6] = {0,1,-1,0,1,-1};
#define INF 1000000007
#define MOD 1000000007
#define ARRAY_MAX 300

bool obstacle[ARRAY_MAX][ARRAY_MAX];
bool used[ARRAY_MAX][ARRAY_MAX];


int main(){

    int t,n;
    while(cin >> t >> n,t||n){

        REP(i,ARRAY_MAX){
            REP(j,ARRAY_MAX){
                obstacle[i][j] = false;
                used[i][j] = false;
            }
        }
        int x,y;
        REP(i,n){//障害物
            cin >> x >> y;
            obstacle[y+100][x+100] = true;
        }
        int sx,sy;//始点
        cin >> sx >> sy;
        int ans = 0;
        queue<Pii> que;
        que.push(Pii(0,P(sy+100,sx+100)));
        while(!que.empty()){
            Pii now = que.front();
            que.pop();
            if(now.first > t || used[now.second.first][now.second.second]++){
                //ターン数を超えたor
                continue;
            }
            ans++;//1箇所行けた
            for(int i = 0;i < 6;i++){
                int ny = now.second.first + dy[i];
                int nx = now.second.second + dx[i];
                if(!obstacle[ny][nx]){
                    //障害物ではない(この時点で行けることが確定)
                    que.push(Pii(now.first+1,P(ny,nx)));
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}


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

using namespace std;
const double pi = 4.0 * atan(1);
int main()
{
	int a, b, x;
	cin >> a >> b >> x;
	int volume = a*a*b;
	double angle, t;
	if(x <= volume/2)
	{
		t = (double)2*x / b / a;
		cout << fixed << setprecision(10) << atan((double)b/t)*180/pi;
	}
	else
	{
		t = (double)2*(volume - x) / a / a;
		cout << fixed << setprecision(10) << atan(t/(double)a)*180/pi;
	}
	return 0;
}

Measured memory_bytes: 256