akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

bool finder(vector<string> vec,string str)
{
    for(int i=0;i<vec.size();i++)
    {
        if(vec[i]==str) return false;
    }
    return true;
}

int main()
{
    vector<string> w(100);

    int n;
    scanf("%d",&n);
    int judge=true;
    for(int i=0;i<n;i++)
    {
        string str;
        cin>>str;
        if(find(w.begin(),w.end(),str)!=w.end())
        {
            judge=false;
            printf("No\n");
            return 0;
        }
        if(i!=0&&str.front()!=w[i-1].back())
        {
            judge=false;
            printf("No\n");
            return 0;
        }
        w[i]=str;
    }
    // if(judge) printf("Yes\n");
    // else printf("No\n");
    printf("Yes\n");
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
void solve(long long n){
	vll v;
	n++;
	while(n>1) {
		if (n%2==1) {v.PB(1); n--;}
		else {v.PB(2); n/=2;}
	}
	reverse(v.begin(),v.end());
	ll id=1;
	vll a,b;
	for (auto &w:v) {
		//printf("id:%d w:%d\n",id,w);
		if (w==1) {
			a.PB(id);
			b.insert(b.begin(),id);
		}
		else {
			a.PB(id); b.PB(id);
		}
		id++;
	}
	ll sz=a.size()+b.size();
	printf("%lld\n",sz);
	for (auto &w:a) printf("%lld ",w);
	for (auto &w:b) printf("%lld ",w);
	printf("\n");
}

int main(){	
	long long N;
	scanf("%lld",&N);
	solve(N);
	return 0;
}



Measured memory_bytes: 256
package main

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

type Node struct {
	value  int
	parent *Node
	left   *Node
	right  *Node
}

type Tree struct {
	root *Node
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n, err := nextInt(sc)
	if err != nil {
		panic(err)
	}

	tree := &Tree{}
	for i := 0; i < n; i++ {
		command := nextText(sc)
		if command == "insert" {
			x, err := nextInt(sc)
			if err != nil {
				panic(err)
			}
			insertTree(x, tree)
		} else if command == "print" {
			printTree(tree)
		} else {
			panic(fmt.Errorf("unknown command: %s\n", command))
		}
	}
}

func insertTree(x int, tree *Tree) {
	if tree.root == nil {
		tree.root = &Node{x, nil, nil, nil}
	} else {
		insertNode(x, tree.root)
	}
}

func insertNode(x int, node *Node) {
	if node.value < x {
		if node.right == nil {
			node.right = &Node{x, node, nil, nil}
		} else {
			insertNode(x, node.right)
		}
	} else {
		if node.left == nil {
			node.left = &Node{x, node, nil, nil}
		} else {
			insertNode(x, node.left)
		}
	}
}

func printTree(tree *Tree) {
	if tree.root == nil {
		fmt.Println("")
		fmt.Println("")
	} else {
		fmt.Println(inorder(tree.root))
		fmt.Println(preorder(tree.root))
	}
}

func preorder(top *Node) string {
	var x string
	x += " " + strconv.Itoa(top.value)
	if top.left != nil {
		x += preorder(top.left)
	}
	if top.right != nil {
		x += preorder(top.right)
	}
	return x
}

func inorder(top *Node) string {
	var x string
	if top.left != nil {
		x += inorder(top.left)
	}
	x += " " + strconv.Itoa(top.value)
	if top.right != nil {
		x += inorder(top.right)
	}
	return x
}

func nextText(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) (int, error) {
	sc.Scan()
	return strconv.Atoi(sc.Text())
}

func nextInts(n int, sc *bufio.Scanner) ([]int, error) {
	rs := make([]int, n)
	for i, _ := range rs {
		x, err := nextInt(sc)
		if err != nil {
			return nil, err
		}
		rs[i] = x
	}
	return rs, nil
}

func printResult(result []int) {
	resultStr := make([]string, len(result))
	for i := 0; i < len(resultStr); i++ {
		resultStr[i] = strconv.Itoa(result[i])
	}
	fmt.Println(strings.Join(resultStr, " "))
}



Measured memory_bytes: 64312
import java.io.*;
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int A = in.nextInt();
    int B = in.nextInt();
    int C = in.nextInt();
    if (A == B && B != C) System.out.println("Yes");
    else if (A == C && B != C) System.out.println("Yes");
    else if (B == C && A != B) System.out.println("Yes");
    else System.out.println("No");
  }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//(a+b-1)/b

signed main(){
	int a,b,n; cin>>a>>b>>n;
	int c=max(a,b);
	cout<<(n+c-1)/c<<endl;
	return 0;
}

Measured memory_bytes: 3604
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long  int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R

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

	cin >> N >> M >> K;
	set<long long int>v;
	set<long long int>w;
	for (int i = 0; i < N; i++) {
		cin >> L;
		v.insert(L);
	}
	for (int i = 0; i < M; i++) {
		cin >> L;
		w.insert(L);
	}
	v.insert(-MOD*100);
	v.insert(MOD*100);
	w.insert(-MOD*100);
	w.insert(MOD*100);
	for (int i = 0; i < K; i++) {
		cin >> L;
		long long int ans = MOD*100;
		auto a = v.lower_bound(L);
		auto b = prev(a);
		auto c = w.lower_bound(L);
		auto d = prev(c);
		long long int aa, bb, cc, dd;
		aa = cc = -MOD*100;
		bb = dd = MOD*100;
		aa = *a;
		bb = *b;
		cc = *c;
		dd = *d;
		ans = min(ans, abs(aa - L) + min(abs(aa - *w.lower_bound(aa)), abs(aa - *prev(w.lower_bound(aa)))));
		ans = min(ans, abs(bb - L) + min(abs(bb - *w.lower_bound(bb)), abs(bb - *prev(w.lower_bound(bb)))));
		ans = min(ans, abs(cc - L) + min(abs(cc - *v.lower_bound(cc)), abs(cc - *prev(v.lower_bound(cc)))));
		ans = min(ans, abs(dd - L) + min(abs(dd - *v.lower_bound(dd)), abs(dd - *prev(v.lower_bound(dd)))));
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    cout << min(b/a, c) << endl;
    return 0;
}

Measured memory_bytes: 256
import cmath
import sys

INF=10**18
MOD=10**9+7
MAX=10**5+7

def main():
    N=int(input())
    dp=[0, 0, 0]
    for line in sys.stdin.readlines():
        a,b,c=map(int, line.split())
        ndp=[0, 0, 0]
        ndp[0]=max(dp[1], dp[2])+a
        ndp[1]=max(dp[2], dp[0])+b
        ndp[2]=max(dp[0], dp[1])+c
        dp=ndp
    print(max(dp))

main()


Measured memory_bytes: 58272
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

void solve(int M,int K){
    if(M==0){
        if(K!=0) cout<<-1<<endl;
        else cout<<"0 0"<<endl;
        return;
    }
    if(M==1){
        if(K!=0) cout<<-1<<endl;
        else cout<<"0 0 1 1"<<endl;
        return;
    }
    if(K>=(1<<M)){
        cout<<-1<<endl;
        return;
    }
    if(K==0){
        for(int bit=0;bit<(1<<M);bit++){
            cout<<bit<<" ";
        }
        for(int bit=(1<<M)-1;bit>=0;--bit){
            cout<<bit<<" ";
        }
        cout<<endl;
        return;
    }
    vector<P> v;
    for(int bit=0;bit<(1<<M);bit++){
        v.push_back(P(min(bit,bit^K),max(bit,bit^K)));
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    for(int i=0;i<v.size();i+=2){
        cout<<v[i].first<<" "<<v[i].second<<" "
        <<v[i+1].first<<" "<<v[i+1].second<<" "
        <<v[i].second<<" "<<v[i].first<<" "
        <<v[i+1].second<<" "<<v[i+1].first<<" ";
    }
    cout<<endl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M,K;cin>>M>>K;
    solve(M,K);
}

Measured memory_bytes: 2932
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		double r = Double.parseDouble(in.next());
		final double pi = Math.PI;
		double area = Math.pow(r, 2) * pi;
		double length = 2 * r * pi;
		
		System.out.println(String.format("%.6f", area) + " " + String.format("%.6f", length));
	}
}	


Measured memory_bytes: 26536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  ll m = n - 1;
  ll ans = 0;
  for (ll i = 1; i * i <= m; i++) {
    if (m % i == 0) {
      ans++;
      if (i != m / i) {
        ans++;
      }
    }
  }

  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) {
      continue;
    }
    ll t = n;
    while (t % i == 0) {
      t /= i;
    }
    if (t % i == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int S = 0;
  for(int i = 0;i < n / 2;i++) {
    if(s[i] != s[n - i - 1]) S++;
  }
  cout << S << endl;
}

Measured memory_bytes: 3588
from collections import deque
def bfs(sl, visited, sy, sx, gy, gx, h, w):
    q = deque([[sy,sx]])
    q_warp = deque([])
    # q_warp = deque([[sy,sx]])
    visited[sy][sx] = 0

    while q:
        while q:
            y, x = q.popleft()
            q_warp.append([y,x])
            if [y, x] == [gy, gx]:
                return visited[gy][gx]
            for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
                ny, nx = y+j, x+k
                if ny >= h or nx >= w or ny < 0 or nx < 0:
                    continue
                if sl[ny][nx] == '.' and visited[ny][nx] == -1:
                    visited[ny][nx] = visited[y][x]
                    q.append([ny,nx])

        while q_warp:
            y, x = q_warp.popleft()
            for j in range(-2,3):
                for k in range(-2,3):
                    ny, nx = y+j, x+k
                    if ny >= h or nx >= w or ny < 0 or nx < 0: continue
                    if sl[ny][nx] == '.' and visited[ny][nx] == -1:
                        visited[ny][nx] = visited[y][x] + 1
                        q.append([ny,nx])

    return -1


h, w = map(int, input().split()) 
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())
sl = [list(input()) for _ in range(h)]
visited = [ [-1]*w for i in range(h)]
ans = bfs(sl,visited,ch-1,cw-1,dh-1,dw-1,h,w)
print(ans)

Measured memory_bytes: 151532
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int N, M, a[55], b[55];

std::vector<std::vector<int>> G;

bool visit[55];


int dfs(int i)
{
  visit[i] = true;

  int c = 1;

  for (const auto& k : G[i])
    if (! visit[k])
      c += dfs(k);

  return c;
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  std::cin >> N >> M;

  for (int i = 0; i < M; i ++) {
    std::cin >> a[i] >> b[i];

    a[i] --;
    b[i] --;
  }

  int c = 0;

  for (int i = 0; i < M; i ++) {
    G.assign(N, std::vector<int>());

    for (int j = 0; j < M; j ++)
      if (j != i) {
        G[a[j]].push_back(b[j]);
        G[b[j]].push_back(a[j]);
      }

    memset(visit, 0, sizeof(visit));

    if (dfs(0) != N)
      c ++;
  }

  std::cout << c << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
// #include <unordered_map>
// #include <unordered_set>
#include <utility>
#include <vector>

#define pb push_back
#define mp make_pair

#ifdef ONLINE_JUDGE
#define link renamelink
#define next renamenext
#define prev renameprev
#endif

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef long double ld;

inline void EnableFileIO(const string& fileName, bool local = 0) {
  if (fileName.empty()) return;
  if (local) {
    freopen((fileName + ".in").c_str(), "r", stdin);
    freopen((fileName + ".out").c_str(), "w", stdout);
    return;
  }
#ifdef ONLINE_JUDGE
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
#endif
}

const int INF = (1 << 30) - 1;
const LL LINF = (1LL << 61) - 1;
const double EPS = 1e-10, PI = acos(-1);
const int N = 3005, P = 1e9 + 7;

int n, m;
int dp[N][N][2];
void add(int& a, int b) {
  a += b;
  if (a >= P) a -= P;
}
int main() {
  // srand((int)time(0));
  // printf("Hello, world!\n");
  // EnableFileIO("");

  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) dp[0][i][0] = 1;
  dp[0][0][1] = 1;

  for (int i = 0; i < m; i++) {
    for (int j = 0; j <= n; j++) {
      for (int iszero = 0; iszero < 2; iszero++) {
        int& cur = dp[i][j][iszero];
        if (!j) {
          add(dp[i + 1][j][1], cur);
          add(dp[i + 1][j + 1][1], cur);
        } else if (j == n) {
          add(dp[i + 1][j][iszero | (j == 1)], cur);
          add(dp[i + 1][j - 1][iszero | (j == 1)], cur);
        } else {
          add(dp[i + 1][j][iszero], cur);
          add(dp[i + 1][j + 1][iszero], cur);
          add(dp[i + 1][j][iszero | (j == 1)], cur);
          add(dp[i + 1][j - 1][iszero | (j == 1)], cur);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) add(ans, dp[m][i][1]);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 70656
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <fstream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(s) (s).begin(),(s).end()
#define ITE(c) typeof((c).begin())

#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(a,b) make_pair((a),(b))

using namespace std;

int main(){
	int n;
	string str;
	cin>>n;
	cin.get();
	rep(j,n){
		getline(cin,str);
		for(int i=6;i<str.size();i++){
			if(str.substr(i-6,7)=="Hoshino"){
				str[i]='a';
			}
		}
		cout<<str<<endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N;
  cin >> N;
  vector<long> data(N + 1);
  for(long i = 1; i < 100; i++){
    for(long j = 1; j < 100; j++){
      for(long k = 1; k < 100; k++){
        if(i * i + j * j + k * k + i * j + j * k + k * i <= N){
          data.at(i * i + j * j + k * k + i * j + j * k + k * i)++;
        }
      }
    }
  }
  for(int i = 1; i <= N; i++)cout << data.at(i) << endl;
  return 0;
}

Measured memory_bytes: 3676
#include <cstdio>
#include <algorithm>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;

using T = std::pair<bool, int>;
using P = std::pair<ll, T>;

ll W, H;
ll p[100010], q[100010];
std::vector<P> ps;

int main()
{
  scanf( "%lld%lld", &W, &H );
  rep( i, W )
  {
    scanf( "%lld", p+i );
    ps.push_back( P( p[i], T( false, i ) ) );
  }
  rep( i, H )
  {
    scanf( "%lld", q+i );
    ps.push_back( P( q[i], T( true, i ) ) );
  }

  std::sort( all(ps) );

  ll ans = 0;

  rep( i, ps.size() )
  {
    if( W <= 0 && H <= 0 )
      break;

    if( ps[i].second.first )
    {
      ans += ps[i].first*(W+1);
      --H;
    }
    else
    {
      ans += ps[i].first*(H+1);
      --W;
    }
  }

  printf( "%lld\n", ans );

  return 0;
}

Measured memory_bytes: 7408
#include<stdio.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<vector>
#include<math.h>
#include<stack>
#include<map>
#include<queue>
using namespace std;
int a[205],b[205];
int main()
{
	int n,m,x,y;
	scanf("%d%d%d%d",&n,&m,&x,&y);
	int mx=-2e9,mn=2e9;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		mx=max(mx,a[i]);
	}
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&b[i]);
		mn=min(mn,b[i]);
	}
	//cout<<mn<<' '<<mx<<endl;
	if(mn>mx&&(mn>x&&mx<y))
	{
		printf("No War");
	}
	else printf("War");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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(){
    ll n;cin >> n;
    ll res=INF;
    ll ans=0;
    ll tmp=0;
    vl v(n);
    rep(i,n)cin >> v[i];
    rep(i,n){
        tmp+=v[i];
        if(i%2==0){
            if(tmp>=0){
                ans+=tmp+1;
                tmp=-1;
            }
        }
        else{
            if(tmp<=0){
                ans+=1-tmp;
                tmp=1;
            }                
        }
    }
    chmin(res,ans);
    ans=0;tmp=0;
    rep(i,n){
        tmp+=v[i];
        if(i%2==1){
            if(tmp>=0){
                ans+=tmp+1;
                tmp=-1;
            }
        }
        else{
            if(tmp<=0){
                ans+=1-tmp;
                tmp=1;
            }                
        }
    }
    chmin(res,ans);
    cout <<res <<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n;
	cin >> n;
	vector<int> p(n);
	REP(i, n)cin >> p[i];
	int j = p.size() - 1;
	bool can=false; int cnt = 0;
	for (int i = 0; i < n / 2; ++i) {
		if (p[i] + p[j] == n + 1) {
			can = true;
			cnt++;
		}
		if (cnt == 2 && p[i]>p[j]) {
			can = false;
			break;
		}
		j--;
	}
	if(can) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / INF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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 gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

using namespace std;

//===================================== template =========================================================

int main() {
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    int n; cin >> n; 
    vector<int> a(n); REP(i, n) cin >> a[i];
    sort(ALL(a)); int m = a[n-1];
    int half = m % 2 == 0 ? m/2 : m/2+1;
    auto lb = lower_bound(ALL(a), half);
    int r = (half - *(lb-1) > *lb - half) ? *lb : *(lb-1);
    cout << m << " " << r << endl;
}

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

int main() {
  long long int n,a,b; cin >> n >> a >> b;
  long long int ans = 0;

  if(a > b) {
    cout << 0 << endl;
    return 0;
  } else if(a == b) {
    cout << 1 << endl;
    return 0;
  } else if(a < b) {
    if(n == 1) { ans = 0; }
    else if(n >= 2) { ans = (n-2)*(b-a) + 1; }
    cout << ans << endl;
    return 0;
  }
}

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

int main(int argc, char **argv) {
  int N;
  string S;

  cin >> N >> S;

  bool res = true;

  if (N % 2 != 0) {
    res = false;
  } else {
    for (int i = 0, j = N / 2; j < N; ++i, ++j) {
      if (S[i] != S[j]) {
        res = false;
        break;
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 256
while True:
   m, f, r = [int(i) for i in input().split()]
 
   if m == f == r == -1:
      break
   total = m + f
   if m == -1 or f == -1 or total < 30:
      print("F")
   
   elif total < 50 and r < 50:
      print("D")

   elif r >= 50 or total < 65:
      print("C")
   
   elif total < 80:
      print("B")

   else:
      print("A")

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;



int main(){
    int n;
    int ans=0;
    cin>>n;
    vector<ll> l(n);
    rep(i,n){
        cin>>l[i];
    }

    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            if(l[i]==l[j]) continue;
            for(int k=j+1;k<n;k++){
                if(l[j]==l[k]||l[k]==l[i]) continue;
                else if((l[i]+l[j]>l[k])
                &&(l[j]+l[k]>l[i])
                &&(l[k]+l[i]>l[j])
                ){
                    //cout<<i+1<<j+1<<k+1<<endl;
                    ans++;
                }
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3632
from sys import stdin

def main():
    N = int(input())
    P = list(map(int, input().split()))

    p = sorted(P)
    n = 0
    for p1, p2 in zip(P, p):
        if p1 != p2:
            n += 1
    if n < 3:
        print('YES')
    else:
        print('NO')

input = lambda: stdin.readline()
main()


Measured memory_bytes: 3060
// #pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
 #pragma GCC target("avx", "avx2")
#include<bits/stdc++.h>

using namespace std;

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

#define int long long
// #define double ld
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
const int mod = 1e9 + 7;

const int N = 1e6 + 56;

int pw(int a, int n) {
    if (n == 0) return 1;
    if (n & 1) return pw(a, n - 1) * a % mod;
    int x = pw(a, n >> 1LL);
    return x * x % mod;
}

int inv[N];
int f[N];


int invert(int a) {
    return pw(a, mod - 2);
}
int C(int n, int k) {
    if (n < 0 || k < 0)
        return 0;
    if (k > n)
        return 0;
    return f[n] % mod * inv[k] % mod * inv[n - k] % mod;
}

signed main() {
    accell();
    int r1, c1, r2, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    int cur = 1;
    int res = 0;
        for (int i = 0; i < r1; ++i) {
            cur *= (c1 + i); cur %= mod;
            cur *= invert(i + 1), cur %= mod;
            res += cur;
        }
        res %= mod;
        cur = 1;
        for (int i = 0; i <= r2; ++i) {
            cur *= (c1 + i); cur %= mod;
            cur *= invert(i + 1); cur %= mod;
            res -= cur;
        }
        res %= mod;
        cur = 1;
        for (int i = 0; i <= c2; ++i) {
            cur *= (r1 + i), cur %= mod;
            cur *= invert(i + 1); cur %= mod;
            res -= cur;
        }
        res %= mod;
        cur = 1;
        for (int i = 0; i <= c2; ++i) {
            cur *= (r2 + 1 + i), cur %= mod;
            cur *= invert(i + 1); cur %= mod;
            res += cur;
        }
        res %= mod;
    cout << res % mod;;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

N=int(input())
A=list(map(int,input().split()))
ans=3**N
tmp=1
for x in A:
    tmp*=1 if x%2 else 2
print(ans-tmp)

Measured memory_bytes: 61836
n,W=map(int,input().split())
w=[0]*n
v=[0]*n
for i in range(n):
  w[i],v[i]=map(int,input().split())
V=[[0]*(W+3) for i in range(n+1)]
for i in range(1,n+1):
  for j in range(1,W+3):
    if j-w[i-1]<0:
      V[i][j]=V[i-1][j]
    else:
      V[i][j]=max(V[i-1][j],V[i-1][j-w[i-1]]+v[i-1])
print(V[n][W])

Measured memory_bytes: 120300
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,ans=0;
    cin>>n;
    for(long long int i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        ans+=i;
    }
    cout<<ans;
}

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

/*再帰関数による最大公約数*/
int gcd(int x,int y){
        return y ? gcd(y, x%y) : x;
}

int main (){
int x,y;
cin>>x>>y;
int s=gcd(x,y);
int ans=1+(x+y)-s;
printf("%d\n",ans);
return 0;
}


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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long

int main(){
	char s[3];
	cin>>s;
	if(s[0]=='9'||s[1]=='9'){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
from collections import deque
H,W = map(int, input().split())
CH,CW = map(lambda x: int(x) - 1, input().split())
DH,DW = map(lambda x: int(x) - 1, input().split())
S = [input() for i in range(H)]
INF = 10 ** 9
walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]
h = CH
w = CW
Distance = [[INF] * W for _ in range(H)]
Distance[h][w] = 0
q = deque(())
q.append((h,w))
while q:
  h,w = q.popleft()
  if [h,w] == [DH,DW]:
    break
  for i,j in walk:
    hwalk = h + i
    wwalk = w + j
    if 0 <= hwalk < H and 0 <= wwalk < W and S[hwalk][wwalk] == '.' and Distance[h][w] < Distance[hwalk][wwalk]:
      Distance[hwalk][wwalk] = Distance[h][w]
      q.appendleft((hwalk,wwalk))
  for i,j in warp:
    hwalk = h + i
    wwalk = w + j
    if 0 <= hwalk < H and 0 <= wwalk < W and S[hwalk][wwalk] == '.' and Distance[h][w] + 1 < Distance[hwalk][wwalk]:
      Distance[hwalk][wwalk] = Distance[h][w] + 1
      q.append((hwalk,wwalk))
print(int(Distance[DH][DW]) if Distance[DH][DW] != INF else -1)

Measured memory_bytes: 82524
i = input()
x = int(i[0:2])
y = int(i[2:4])

def isMM(a):
  return 1 <= a and a <= 12

r = isMM(x) * 2 + isMM(y)

print(["NA", "YYMM", "MMYY", "AMBIGUOUS"][r])

Measured memory_bytes: 2940
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;



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

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> K;
		if (K & 1)continue;
		if (K % 3 && K % 5) {
			cout << "DENIED\n";
			return 0;
		}
	}
	cout << "APPROVED\n";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <map>

//#include <bits/stdc++.h>
using namespace std;
#define print(x) cout<<(x)<<endl
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int a, b, h;
  cin >> a >> b >> h;
  print((a+b)*h/2);

}


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

using namespace std;

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


int main()
{
  int n;
  int flag = 0;
  cin >> n;
  vector<int> so;
  for (int i = 3; i <= 55555; i++){
    flag = 0;
    for (int j = 2; j <= i - 1; j++){
      if (i % j == 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 0 && i % 5 == 1) {
      so.push_back(i);
    }
  }

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


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

int main(){
	int n; cin >> n;
	
	ll li[5] = {};
	for(int i = 0; i < n; i++){
		string s; cin >> s;
		
		if(s[0] == 'M') li[0]++;
		if(s[0] == 'A') li[1]++;
		if(s[0] == 'R') li[2]++;
		if(s[0] == 'C') li[3]++;
		if(s[0] == 'H') li[4]++;
	}
	
	ll c = 0;
	for(int i = 0; i < 5; i++){
		for(int j = 0; j < i; j++){
			for(int k = 0; k < j; k++){
				c += li[i] * li[j] * li[k];
			}
		}
	}
	cout << c << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;

ll arr[1000005];

void freq(ll N, string S, int curr) {
      for(ll i=0; i<N; i++) {
            curr = (int)S[i]; // cast current letter of string S to ASCII
            arr[curr]++;
      }
}

ll multiply(ll N, string S, ll ans) {

      ll temp = pow(10,9) + 7;
      for(int i=(int)'a'; i<=(int)'z'; i++) {
            ans *= (arr[i]+1);
            ans = ans % temp; 
      }
      return ans; 
}

void solution(ll N, string S) {
      freq(N, S, 0);
      ll res = multiply(N, S, 1) - 1;
      cout << res << endl; 
}


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

      ll N;
      string S;
      cin >> N >> S;

      solution(N, S);
}


Measured memory_bytes: 3300
a, b = map(int, input().split())
c = []
d = []
for i in range(1, a + 1):
    if i % b == 0:
        c.append(i)
    elif i % b == b / 2:
        d.append(i)
e = 0
print(len(c) * len(c) * len(c) + len(d) * len(d) * len(d))


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

using namespace std;
int main() {

	int manzoku=0;
	int N ;

	cin >> N;

	int pre = -10;

	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N-1);

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	for (int i = 0; i < N; i++)
	{
		cin >> B[i];
	}
	for (int i = 0; i < N-1; i++)
	{
		cin >> C[i];
	}
	
	for (int i = 0; i < N; i++)
	{
		if (A[i] - pre == 1&&i>0)
		{
			manzoku += C[pre-1];
		}
		manzoku += B[A[i]-1];
		pre = A[i];
	}


	cout << manzoku;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,C;
int B[1005],A[1005][1005],ans=0;
int main()
{
	cin>>n>>m>>C;
	for(int i=1;i<=m;i++) cin>>B[i];
	for(int j=1;j<=n;j++)
	for(int i=1;i<=m;i++) 
	cin>>A[j][i];
	for(int j=1;j<=n;j++)
	{
		int now=C;
		for(int i=1;i<=m;i++) now+=A[j][i]*B[i];
		if(now>0) ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
int num,tnum,dgt=1,count,rem;
scanf("%d",&num);
count=0;
tnum=num;
while(tnum>0){
    rem=tnum%10;
    if(rem==dgt)
        count++;
    tnum=tnum/10;
}
printf("%d",count);
return 0;
}


Measured memory_bytes: 128
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def ris(): return list(input())
def pli(a): return "".join(list(map(str, a)))

r,g,b = rli()

if((100*r+10*g+b) % 4 == 0):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
inline int read()
{
	int x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{if(ch == '-')	f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 5005 , mod = 1e9 + 7;
struct Edge
{
	int to; Edge *nxt;
	Edge(int to = 0,Edge *nxt = NULL) : to(to) , nxt(nxt) {}
} *head[N] , pool[N << 1] , *tail = pool;
inline void add(int u,int v) { head[u] = new (tail ++) Edge(v,head[u]);}
int n;
int size[N];
ll g[N] , f[N][N] , h[N];
void dfs(int u,int fa)
{
	f[u][size[u] = 1] = 1;
	for(Edge *i = head[u];i;i = i -> nxt)
	{
		int v = i -> to;
		if(v == fa) continue;
		dfs(v,u);
		for(int j = 1;j <= size[u] + size[v];j ++) h[j] = 0;
		for(int j = size[u];j >= 1;j --) for(int k = size[v];k >= 0;k --) h[j + k] = (h[j + k] + f[u][j] * f[v][k]) % mod;
		size[u] += size[v];
		for(int j = 1;j <= size[u];j ++) f[u][j] = h[j];
	}
	for(int i = 2;i <= size[u];i += 2) f[u][0] = (f[u][0] - f[u][i] * g[i] % mod + mod) % mod;
}
int main()
{
	n = read(); g[0] = 1;
	for(int i = 2;i <= n;i += 2) g[i] = g[i - 2] * (i - 1) % mod;
	for(int i = 1 , u , v;i < n;i ++) u = read() , v = read() , add(u,v) , add(v,u);
	dfs(1,0);
	printf("%lld\n",mod - f[1][0]);
	return 0;
}

Measured memory_bytes: 194944
def main():
    n, m = list(map(int, input().split()))
    ans = set([1, ])
    balls = [1] * n
    for _ in range(m):
        x, y = list(map(int, input().split()))
        if x in ans:
            ans.add(y)
        if balls[x - 1] == 1 and x in ans:
            ans.remove(x)
        balls[x - 1] -= 1
        balls[y - 1] += 1
    print(len(ans))

if __name__ == '__main__':
    main()


Measured memory_bytes: 53080
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

ll int power(ll int x, ll int y, ll int p)  
{  
   ll int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}  
 


 
int main()
{
  fastio();
ll int T;
T=1;


ll int anscount=1,i,j,k;
while(T--)
{
 ll int n,count=0;
 cin>>n;
 ll int sum=100;
 while(sum<n)
 {
  sum*=1.01;
  count++;
 }
 cout<<count<<endl;
  
 

}






    return 0;
}

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

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

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

double d[200010];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int h,n;
	cin>>h>>n;

	ll sum =0;
	
	for(int i=0; i<n; i++){
		int tmp;cin>>tmp;
		
		sum += tmp;
	}
	if(sum >=h){
		writeln("Yes")
	}else {
		writeln("No");
	}

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String n = sc.next();
    String ans = "";
    for(int i = 0; i < 3; i++) {
      if(n.charAt(i) == '1')
        ans += '9';
      else
        ans += '1';
    }
    System.out.println(ans);
  }

}


Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
using namespace std;
int main(){
	int n,a,b,c;
	int l[8];
	cin>>n>>a>>b>>c;
	for(int i=0;i<n;i++){
		cin>>l[i];
	}
	int mi=1e9+7;
	for(int i=0;i<(1<<(2*n));i++){
		int now=0;
		int hoge=i;
		vector<int> ans;
		while(hoge!=0){
			if(hoge==hoge%(1<<(2*(now+1)))){
				ans.push_back(hoge/(1<<(2*now)));
				break;
			}else if(hoge%(1<<(2*(now+1)))!=0){
				ans.push_back(hoge%(1<<(2*(now+1)))/(1<<(2*now)));
				hoge-=hoge%(1<<(2*(now+1)));
			}else{
				ans.push_back(0);
			}
			now++;
		}
		int ca=0,cb=0,cc=0;
		int la=0,lb=0,lc=0;
		for(int j=0;j<ans.size();j++){
			if(ans[j]==1){
				ca++;
				la+=l[j];
			}else if(ans[j]==2){
				cb++;
				lb+=l[j];
			}else if(ans[j]==3){
				cc++;
				lc+=l[j];
			}
		}
		if(la==0||lb==0||lc==0){
			continue;
		}
		if(la<lb){
			swap(la,lb);
		}
		if(lb<lc){
			swap(lb,lc);
		}
		if(la<lb){
			swap(la,lb);
		}
		int cost=0;
		if(ca!=0){
			cost+=(ca-1)*10;
		}
		if(cb!=0){
			cost+=(cb-1)*10;
		}
		if(cc!=0){
			cost+=(cc-1)*10;
		}
		cost+=abs(la-a);
		cost+=abs(lb-b);
		cost+=abs(lc-c);
		mi=min(mi,cost);
	}
	cout<<mi<<endl;
	return 0;
}


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

int main(int argc, char const *argv[])
{
	char str[100000];
	scanf("%s",str);
	for (int i = 0; i < strlen(str); i += 2)
	{
		printf("%c",str[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 20000;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    int ansm = 100*a,anss = 0;
    double den = 0;
    rep(i,31){
        rep(j,31){
            rep(m,101){
                rep(n,101){
                    int water = i*100*a+j*100*b;
                    int sugar = m*c+n*d;
                    if (water == 0 || water+sugar > f || sugar > water*e/100) continue;
                    double newd = (double)sugar/(double)(water+sugar);
                    if (newd > den){
                        den = newd;
                        anss = sugar;
                        ansm = water+sugar;
                    }
                }
            }
        }
    }
    PRINT(ansm << " " << anss);
}

Measured memory_bytes: 256
//The best is yet to come...
 #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define boost1 ios::sync_with_stdio(false);
#define boost2 cin.tie(0);
#define mem(a,val) memset(a,val,sizeof a)
#define endl "\n"
#define maxn 100001

ll x[maxn];
int main()
{
    boost1;boost2;
    ll i,j,n,a,b,y,ans=0; 
    cin>>n>>a>>b;
    for(i=1;i<=n;i++)
    cin>>x[i];
    for(i=2;i<=n;i++)
    {
        y=x[i]-x[i-1];
        if(y*a<b)
        ans+=y*a;
        else
        ans+=b;
    }   
    cout<<ans;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int n = s.length();
  REP(i, n) {
    if (i % 2 == 1 && s[i] == 'R') {
      cout << "No\n";
      return 0;
    } else if (i % 2 == 0 && s[i] == 'L') {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}


Measured memory_bytes: 256
var shift=(function(){
   var i=0;
   return function(){
      i++;
      return Arr[i-1];
   }
})();
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
while(true){
   var nm=(shift()).split(" ").map(Number);
   if(nm[0]==0 && nm[1]==0)break;
   var n=nm[0];
   var m=nm[1];
   var N=[];
   var M=[];
   for(var i=0;i<n;i++)N.push(shift()-0);
   for(var i=0;i<m;i++)M.push(shift()-0);
   var x=0;
   for(var i=0;i<m;i++){
      x+=M[i];
      if(x>=n-1)break;
      x+=N[x];
      if(x>=n-1)break;
   }
   console.log(i+1);
}

Measured memory_bytes: 8740