akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

long long int fact(long long int n){
	if(n == 1){
		return 1;
	}else{
		return n*fact(n-1);
	}
}

int main(){
	long long int n;
	cin >> n;
	cout << fact(n) << endl;
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = 1000000;
        boolean[] primes = new boolean[N];
        for (int i = 2; i < N; i++) {
            primes[i] = true;
        }

        for (int i = 2; i < N; i++) {
            if (i * i > N) {
                break;
            }
            if (primes[i]) {
                for (int j = i + i; j < N; j += i) {
                    primes[j] = false;
                }
            }
        }

        while (in.hasNext()) {
            // 1 ??? n ??? 999,999
            int n = in.nextInt();
            int count = 0;
            for (int i = 2; i <= n; i++) {
                if (primes[i]) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}

Measured memory_bytes: 27696
#include<stdio.h>
int main(void)
{
	int a;
	while(scanf("%d",&a)!=EOF)
	{
		int x=0,y=0,s,i,total=0;
		for(i=0;i<(600/a);i++){
			x=a*i;
			y=(x*x);
			s=y*a;
			total+=s;
		}
		printf("%d\n",total);
	}
        return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

#define NUM 10000

int main()
{
	int x[NUM], y[NUM], tmp, i = 0;
	
	while(1) {
		scanf("%d %d", &x[i], &y[i]);
		if ((x[i] == 0) && (y[i] == 0)) {
			i = 0;
			break;
		}
		i++;
	}
	
	while(1){
		if ((x[i] == 0) && (y[i] == 0)) {
			break;
		}
		if (x[i] > y[i]) {
			printf("%d %d\n", y[i], x[i]);
		}	else {
			printf("%d %d\n", x[i], y[i]);
		}
		i++;
	}
	
	return 0;
}

Measured memory_bytes: 628
long a,b,c,d,M=1e9+7,w[1001][1001],e[1001],P[1001][1001],n,i,j;int p(long a,int b){return b?b%2?p(a*a%M,b/2)*a%M:p(a*a%M,b/2)%M:1;}main(k){for(scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);i<=n;)w[i++][0]=1;for(*e=i=1;i<=n;)e[i]=e[i-1]*i++%M;for(i=0;i++<n;)for(j=i;~j;)P[i][j]=e[i]*p(e[i-j--],M-2)%M;for(;i--;)e[i]=p(e[i],M-2);for(i=a-1;i++<b;)for(j=-1;j++<n;)for(w[i][j]=w[i-1][j],k=c;k<=d&&k<=j/i;)w[i][j]=(w[i][j]+w[i-1][j-i*k]*P[n-j+i*k][i*k]%M*p(e[i],k)%M*e[k++]%M)%M;printf("%d\n",w[b][n]);}

Measured memory_bytes: 14848
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    rep(i,1,n){
        if(a[i] < a[i-1]){
            ans += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }

    cout << ans << "\n";
}

Measured memory_bytes: 4780
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007
var inf int = 1000000000000

type lazysegtree struct {
	n    int
	node []int
	lazy []int
}

func newlazySegtree(v []int) *lazysegtree {
	sz := len(v)
	_n := 1
	for _n < sz {
		_n *= 2
	}
	_node := make([]int, 2*_n-1)
	_lazy := make([]int, 2*_n-1)
	for i := 0; i < sz; i++ {
		_node[i+_n-1] = v[i]
	}
	for i := _n - 2; i >= 0; i-- {
		_node[i] = _node[2*i+1] + _node[2*i+2]
	}
	return &lazysegtree{
		n:    _n,
		node: _node,
		lazy: _lazy,
	}
}

// k番目のノードについて遅延評価を行う
func (u lazysegtree) eval(k int, l int, r int) {
	if u.lazy[k] != 0 {
		u.node[k] += u.lazy[k]
		if r-l > 1 {
			u.lazy[2*k+1] += u.lazy[k] / 2
			u.lazy[2*k+2] += u.lazy[k] / 2
		}
		u.lazy[k] = 0
	}
	return
}

func (u lazysegtree) add(a int, b int, x int, k int, l int, r int) {
	if r < 0 {
		r = u.n
	}
	u.eval(k, l, r)
	if b <= l || r <= a {
		return
	}
	if a <= l && r <= b {
		u.lazy[k] += (r - l) * x
		u.eval(k, l, r)
	} else {
		u.add(a, b, x, 2*k+1, l, (l+r)/2)
		u.add(a, b, x, 2*k+2, (l+r)/2, r)
		u.node[k] = u.node[2*k+1] + u.node[2*k+2]
	}
}

//[a,b)内の合計の取得
func (u lazysegtree) getsum(a int, b int, k int, l int, r int) int {
	if r < 0 {
		r = u.n
	}
	if r <= a || b <= l {
		return 0
	}
	u.eval(k, l, r)
	if a <= l && r <= b {
		return u.node[k]
	}
	vl := u.getsum(a, b, 2*k+1, l, (l+r)/2)
	vr := u.getsum(a, b, 2*k+2, (l+r)/2, r)
	return vl + vr
}

//牛木の実装
//----------------------------
//一点更新区間取得のためのセグ木
//----------------------------
func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	//予備
	n := iScan()
	m := iScan()
	d := (n - 1) / 2
	ans := make([][]int, 0)
	right := d / 2
	left := d - right
	for i := 1; i <= left; i++ {
		tmp := make([]int, 2)
		tmp[0] = i
		tmp[1] = 2*left + 1 - i
		ans = append(ans, tmp)
	}
	for i := 1; i <= right; i++ {
		tmp := make([]int, 2)
		tmp[0] = i + 2*left
		tmp[1] = 2*left + right*2 - i + 2
		ans = append(ans, tmp)
	}
	for i := 0; i < m; i++ {
		fmt.Println(ans[i][0], ans[i][1])
	}
}

Measured memory_bytes: 8568
from itertools import combinations

S = input()
lenS = len(S)
idx_list = [i for i in range(1,lenS)]
ans = 0
for i in range(1, lenS):
  for combination in combinations(idx_list, i):
    prv_idx = 0
    for idx in combination:
      ans += int(S[prv_idx:idx])
      prv_idx = idx
    ans += int(S[idx:])
print(ans+int(S))

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

int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == '+') {
    cout << a + b << endl;
  } else {
    cout << a - b << endl;
  }
}


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

int main(int argc, char **argv)
{
	int x;
	cin >> x;

	bool ans = false;
	if (x == 5 || x == 3 || x == 7)
		ans = true;

	std::cout << (ans ? "YES" : "NO") << std::endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC031
{
    class A
    {
        static void Main(string[] args)
        {
            ulong t = 1000000007;
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            ulong[] f = new ulong[26];
            for (int i = 0; i < n; i++)
            {
                f[s[i] - 97]++;
            }
            for (int i = 0; i < 26; i++)
            {
                f[i]++;
            }
            ulong ans = 1;
            for (int i = 0; i < 26; i++)
            {
                ans *= f[i];
                ans %= t;
            }
            Console.WriteLine(ans - 1);
        }
    }
}


Measured memory_bytes: 13244
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, h, n);
    int acc = 0;
    Rep(n){
        Cin(int, x);
        acc += x;
    }
    CoutYn(acc >= h);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(unsigned i=0;i<n;i++)
#define repr(i,n) for(unsigned i=n-1;i>=0;i--)
#define rep1(i,n) for(unsigned i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define cins(s,n) rep(i,n)cin>>s.at[i];
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,t;cin>>n>>t;
    vi p(n);cin_pl(n,p);
    vi delta;
    rep(i,n-1)
    {
        delta.push_back(p[i+1]-p[i]);
    }
    int ans=t;
    rep(i,n-1)
    {
        if(delta[i]>=t)
        ans+=t;
        else
        {
            ans+=delta[i];
        }
        
    }
    cout<<ans;



}

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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
string S;
int A,B;
int main(){
	cin>>A>>B;

	if((A+B)>23)cout<<A+B-24<<endl;
	else cout<<A+B<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	
	string s;
	cin >> s;
	int cnt = 0;
	for(auto c : s) if(c == 'o') cnt++;
	cout << 700 + cnt * 100 << endl;
	
	
	
	
	
    return 0;
}

Measured memory_bytes: 256
// 参考
// https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r"50 100 120
" => r"Yes",

r"500 100 1000
" => r"No",

r"19 123 143
" => r"No",

r"19 123 142
" => r"Yes"
}

use std::cmp;
use std::collections::HashSet;
use std::f32::MAX;

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: i32,
        b: i32,
        c: i32
    }

    if a + b >= c {
        "Yes".to_string()
    } else {
        "No".to_string()
    }
}


Measured memory_bytes: 4352
#!/usr/bin/env python3

N = int(input())
S = input()

cnt = 1

check = S[0]

for i, s in enumerate(S[1:]):
    if s == check:
        if i == N - 1:
            cnt += 1
        continue
    else:
        cnt += 1
        check = s

print(cnt)


Measured memory_bytes: 3316
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

	public void Proc()
	{
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int n = inpt[0];
        int m = inpt[1];
        int l = inpt[2];

        long[,] mapA = new long[n, m];
        for (int i = 0; i < n; i++) {
            inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            for (int j = 0; j < m; j++) {
                mapA[i, j] = inpt[j];
            }
        }
        long[,] mapB = new long[m, l];
        for (int i = 0; i < m; i++) {
			inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
			for (int j = 0; j < l; j++)
            {
                mapB[i, j] = inpt[j];
            }
        }

        System.Text.StringBuilder ans = new System.Text.StringBuilder();
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < l; j++) {
                long tmp = 0;
                for (int k = 0; k < m; k++) {
                    tmp += mapA[i, k] * mapB[k, j];
                }
                if(j>0) {
                    ans.Append(" ");
                }
                ans.Append(tmp.ToString());
            }
            ans.AppendLine(string.Empty);
        }

        Console.Write(ans.ToString());

    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


3 2 3
1 2
0 3
4 5
1 2 1
0 3 2



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 10360
H,W,K=map(int,input().split())

smat=[[1 if x=="#" else 0 for x in input()] for _ in range(H)]
#print(smat)

answer_mat=[[0]*W for _ in range(H)]
cnt=1
lastrow_exist=-1
for i in range(H):
  row_num=sum(smat[i])
  if row_num==0:
    continue
  elif row_num==1:
    for j in range(W):
      for ii in range(lastrow_exist+1,i+1):
        answer_mat[ii][j]=cnt
    cnt+=1
    lastrow_exist=i
  else:
    berry_list=[0]*W
    isFirst=True
    for j in range(W):
      if smat[i][j]==1:
        if not isFirst:
          cnt+=1
        else:
          isFirst=False
      berry_list[j]=cnt
    
    for j in range(W):
      for ii in range(lastrow_exist+1,i+1):
        answer_mat[ii][j]=berry_list[j]
        
    cnt+=1
    lastrow_exist=i
        
if lastrow_exist<H-1:  
  for j in range(W):
    for ii in range(lastrow_exist+1,H):
      answer_mat[ii][j]=answer_mat[lastrow_exist][j]
      
for i in range(H):
  print(*answer_mat[i])

Measured memory_bytes: 76472
N = int(input())
b = list(map(int, input().split()))
ans = []
cnt = 0
while len(b): 
  for j in range(len(b)-1, -1, -1):
    if b[j] == j+1:
      ans += [b.pop(j)]
      break
  cnt += 1
  if cnt >= N+1:
    print(-1)
    exit()
    
for n in ans[::-1]:
  print(n)

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

int main() {
  int a;
  cin >> a;

  cout << floor(a / 3600) << ":" << (int)(floor(a / 60)) % 60 << ":" << a % 60 << endl;
  return 0;
}



Measured memory_bytes: 3292
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	}
}

Measured memory_bytes: 21844
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
b=[list(map(int,input().split())) for i in range(m)]
b.sort(key=lambda x:x[1])
p=0
c=[]
for i in b[::-1]:
  if p>n:
    break
  c+=[i[1]]*i[0]
  p+=i[0]
n=min(len(c),n)
c=c[:n]
m=sum(a)
x=m
for i in range(n):
  m=m-a[i]+c[i]
  x=max(x,m)
print(x)

Measured memory_bytes: 34512
#include <stdio.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
//using namespace std;

int main()
{
    char a[100], b[100], c[100];
    int i = 0, j = 0, k = 0;
    int inda = 0, indb = 0, indc = 0;

    gets(a);
    gets(b);
    gets(c);

    int lena = strlen(a), lenb = strlen(b), lenc = strlen(c);

    int current = 1, flag = TRUE;

    while (flag) {
        while (current == 1) {
            if (i == lena) {
                ++inda;
                flag = FALSE;
                break;
            }
            else if (a[i] == 'b') {
                current = 2;
            }
            else if (a[i] == 'c') {
                current = 3;
            }
            ++i;
            /*if (i == lena) {
                ++inda;
                flag = FALSE;
                break;
            }*/
        }
        //if (inda) break;
        while (current == 2) {
            //printf("\nHi there");           ///debugger#1
            if (j == lenb) {
                ++indb;
                flag = FALSE;
                break;
            }
            else if (b[j] == 'a') {
                current = 1;
            }
            else if (b[j] == 'c') {
                current = 3;
            }
            ++j;
            /*if (j == lenb) {
                ++indb;
                flag = FALSE;
                break;
            }*/
        }
       // if (indb) break;
        while (current == 3) {
            if (k == lenc) {
                ++indc;
                flag = FALSE;
                break;
            }
            if (c[k] == 'b') {
                current = 2;
            }
            else if (c[k] == 'a') {
                current = 1;
            }
            ++k;
            /*if (k == lenc) {
                ++indc;
                flag = FALSE;
                break;
            }*/
        }
       // if (indc) break;
    }
    //printf("%d %d %d\n %d %d %d", inda, indb, indc, i, j, k);
    if (inda) printf("A");
    else if (indb) printf("B");
    else if (indc) printf("C");


    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll, ll> pll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define foro(i, n) for(i=0; i<n; i++)
#define forl(i, n) for(i=1; i<=n; i++)
#define x first
#define y second
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 1e18 + 1;

ll power(ll n){
	if(n==1)	return 1;
	return (power(n>>1) << 1) +1;
}

int main()
{
	int i, j, k, l, tmp;
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	ll n;
	cin >> n;
	printf("%lld\n", power(n));
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

int main(void) {
  int a, b;
  std::cin >> a >> b;
  std::cout << std::max(0, a - 2 * b) << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int ans = 0;
    for(int i = 0;i < 3;i++){
      if(!(a.substring(i,i+1).equals(b.substring(2-i,3-i)))){
        ans = 1;
      }
    }
    if(ans == 0){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
  string A;
  cin>>A;
  int ans=0;
  int kouho=0;
  for(int i=0; i<A.size(); i++){
    if(A.at(i)=='R'){
      kouho++;
    }
    else{
      ans=max(ans, kouho);
      kouho=0;
    }
  }
  ans=max(ans, kouho);
  cout<<ans<<endl;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    vll a(4);
    REP(i, 4){
        cin >> a[i];
    }
    ll n;
    cin >> n;
    // 2L買うための最小金額
    ll x2 = 1e18, d1 = 1;
    REP(i, 4){
        x2 = min(x2, 8 * a[i] / d1);
        d1 *= 2;
    }
    // 1L
    ll x1 = 1e18, d2 = 1;
    REP(i, 3){
        x1 = min(x1, 4 * a[i] / d2);
        d2 *= 2;
    }
    ll res = n / 2 * x2;
    n %= 2;
    if (n) res += x1;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int main() {
    int n,ans = 0;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    while(*max_element(h.begin(),h.end())){
        for (int i = 0; i < n; ++i) {
            if(h[i] == 0) continue;
            while(i < n && h[i] > 0){
                h[i]--;
                i++;
            }
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; i++ )
#define MAX 10

struct Cell{ int i, j, x, id; };

int H, W, n, b, k; 
Cell P[MAX*MAX], M[MAX][MAX], A[MAX][MAX];
int V[MAX+1];

int ans;

bool check(int si, int sj, int r, int c ){
    rep(i, r) rep(j, c){
	int ii = si + i;
	int jj = sj + j;
	if ( ii < 0 || jj < 0 || ii >= H || jj >= W ) return false;
	if ( M[ii][jj].x ) return false;
    }
    return true;
}

void solve(int pos){
    if ( pos >= n ){ 
	rep(i, H) rep(j, W) if ( M[i][j].x == 0 ) return;
	rep(i, H) rep(j, W) A[i][j] = M[i][j];
	ans++;
	return;
    }

    for(int r = 1; r <= P[pos].x; r++){
	if ( P[pos].x % r != 0 ) continue;
	int c = P[pos].x / r;
	rep(di, r) rep(dj, c){
	    int si = P[pos].i - di;
	    int sj = P[pos].j - dj;
	    if ( check( si, sj,  r, c ) ){
		rep(i, r) rep(j, c) M[si+i][sj+j] = P[pos];
		solve( pos + 1 );
		rep(i, r) rep(j, c) M[si+i][sj+j].x = 0;
	    }
	}
    }
}

int main(){
    int x;
    while( cin >> W >> H && H && W ){
	cin >> n;
	rep(i, n){
	    cin >> b >> k;
	    P[b-1].x = k;
	}

	rep(i, H) rep(j, W){
	    cin >> x;
	    if ( x ){  P[x-1].i = i; P[x-1].j = j; P[x-1].id = x-1; }
	    M[i][j].x = 0;
	}
	ans = 0;
	solve(0);
	if ( ans == 1 ) {
	    rep(i, H){
		rep(j, W){
		    if ( j ) cout << " ";
		    cout << A[i][j].id+1;
		}
		cout << endl;
	    }
	} else {
	    cout << "NA" << endl;
	}
    }
    return 0;
}

Measured memory_bytes: 872
#include<algorithm>
#include<stdio.h>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
	int R[MAX], n;
	cin>> n;
	for (int i = 0; i < n; i++){
		cin >> R[i];
	}
	int k = 0;
	bool flag = 1;
	for (int i = 0; flag; i++){
		flag = 0;
		for (int j = n - 1; j > i; j--){
			if (R[j - 1] > R[j]){
				swap(R[j - 1], R[j]);
				k++;
				flag = 1;
			}
		}
	}
	for (int i = 0; i < n; i++){
		if (i != 0)
			printf(" ");
		printf("%d", R[i]);
	}
	printf("\n%d\n", k);
	return 0;
}

Measured memory_bytes: 3124
#include<stdio.h>

int main(void){
  int N,K,Q;
  scanf("%d%d%d",&N,&K,&Q);
  int A[Q];
  int Judge[N];
  for(int i = 0;i < N;i++)
    Judge[i] = 0;
  for(int i  = 0;i < Q;i++){
    scanf("%d",&A[i]);
    Judge[A[i] - 1]++;
  }
    
  for(int i = 0;i < N;i++){
    if(Q - K >= Judge[i])
      printf("No");
    else
      printf("Yes");
    putchar('\n');
  }  
  return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll k;
	int ans=0;
	cin >>n>>k;
	Vi a(n);
	rep(i,n){
		cin>>a[i];
		a[i]--;
	}
	ll turn=0LL;
	bitset<200010> has(0uL);
	has.set(0);
	Vi last;
	ll head=0LL;
	int start=0;
	last.push_back(0);
	while(1){
		if(has[a[last.back()]]){
			start=a[last.back()];
			break;
		}else{
			has.set(a[last.back()]);
			last.push_back(a[last.back()]);
		}
	}
	for(head=0;last[head]!=start;head++);
	turn=last.size()-head;
	clog<<start<<endl;
	clog<<head<<endl;
	clog<<turn<<endl;
	if(k <head){
		ans=last[k];
	}else{
		k-=head;
		ans=last[k%turn+head];
	}
	cout<<ans+1<<endl;
}

Measured memory_bytes: 5128
#include<stdio.h>

int main(void){

  int i,j;
  char map[9][8];
  char tmp;
  int flag;

  while(scanf("%s",map[0])!=EOF){

    for(i=1;i<8;i++)scanf("%s",map[i]);
    scanf("%c",&tmp);

    flag = 0;
    for(i=0;i<8;i++){
      for(j=0;j<8;j++){
	if(map[i][j] == '1'){
	  if(map[i][j+1] == '1'){
	    if(map[i][j+2] == '1'){
	      printf("C\n");
	      flag = 1;
	    }else{
	      if(map[i+1][j] == '1'){
		if(map[i+1][j+1] == '1'){
		  printf("A\n");
		  flag = 1;
		}else{
		  printf("G\n");
		  flag = 1;
		}
	      }else{
		printf("E\n");
		flag = 1;
	      }
	    }
	  }else{
	    if(map[i+2][j] == '1'){
	      printf("B\n");
	      flag = 1;
	    }
	    else if(map[i+1][j+1] == '1'){
	      printf("F\n");
	      flag = 1;
	    }
	    else if(map[i+1][j-1] == '1'){
	      printf("D\n");
	      flag = 1;
	    }
	  }
	}
	if(flag)break;
      }
      if(flag)break;
    }

  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()


int main()
{
    ll N;
    cin>>N;
    VL A(N+1);
    VL B(N);
    rep(i,0,N+1)cin>>A[i];
    rep(i,0,N)cin>>B[i];

    ll ans=0;
    rep(i,0,N){
        if(B[i]<A[i]){
            ans+=B[i];
            A[i]=A[i]-B[i];
            B[i]=0;
        }else if(B[i]>=A[i]){
            ans+=A[i];
            B[i]=B[i]-A[i];
            A[i]=0;
            if(B[i]<A[i+1]){
                ans+=B[i];
                A[i+1]=A[i+1]-B[i];
                B[i]=0;
            }else if(B[i]>=A[i+1]){
                ans+=A[i+1];
                B[i]=B[i]-A[i+1];
                A[i+1]=0;
            }
        }
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 1792
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[][] l = new int[100001][2];
		int[][] r = new int[100001][2];
		for (int i = 0; i < N / 2; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			l[a][0] = a;
			l[a][1]++;
			r[b][0] = b;
			r[b][1]++;
		}
		Arrays.sort(l, (x, y) -> Integer.compare(x[1], y[1]));
		Arrays.sort(r, (x, y) -> Integer.compare(x[1], y[1]));
		if (l[l.length - 1][0] != r[r.length - 1][0]) {
			System.out.println(N - l[l.length - 1][1] - r[r.length - 1][1]);
		} else {
			System.out.println(
					Math.min(N - l[l.length - 2][1] - r[r.length - 1][1], N - l[l.length - 1][1] - r[r.length - 2][1]));
		}
		in.close();
	}
}

Measured memory_bytes: 65416
import java.util.*;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        long h = sc.nextInt();
        long w = sc.nextInt();
        int n = sc.nextInt();
        
        Map<Long, Integer> po = new HashMap<>();
        long[] ans = new long[10];
        ans[0] = (h-2)*(w-2);
        for(int t=0; t<n; t++){
            int a = Integer.parseInt(sc.next())-1;
            int b = Integer.parseInt(sc.next())-1;
            ArrayList<Integer> chg = new ArrayList<>();
            
            for(int i=0; i<3; i++){
                for(int j=0; j<3; j++){
                    if(!(0<=a+i-2 && a+i<h && 0<=b+j-2 && b+j<w)) continue;
                    int cnt = 0;
                    for(int k=0; k<3; k++){
                        for(int l=0; l<3; l++){
                            int y = a+i+k-2;
                            int x = b+j+l-2;
                            cnt += po.getOrDefault(y*(1L<<30)+x, 0);
                        }
                    }
                    chg.add(cnt);
                }
            }
            for(int cnt : chg){
                ans[cnt]--;
                ans[cnt+1]++;
            }
            po.put(a*(1L<<30)+b, 1);
        }
        
        for(int i=0; i<10; i++){
            System.out.println(ans[i]);
        }
    }
}


Measured memory_bytes: 178732
def main():
	row, column = (int(a) for a in input().split())
	sheet = []
	for i in range(row):
		c = []
		for m in input().split():
			c.append(int(m))
		sheet.insert(i, c)
	for i in range(row):
		sheet[i].append(sum(sheet[i]))
		string = map(str, sheet[i])
		printColumn(sheet[i])
	l = []
	for m in range(column + 1):
		s = 0
		for r in range(row):
			s += sheet[r][m]
		l.append(s)
	printColumn(l)

def printColumn(list):
	string = map(str, list)
	print(' '.join(string))

main()



Measured memory_bytes: 5684
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>

int main()
{
    int ans = 0, n, x, m[100] = {0}, m_first, temp, k = 0;
    std::cin >> n >> x;
    for (int i = 0;i < n;i++){
        std::cin >> m[i];
    }
    m_first = 100 - n;

    while(1){
        for(int i = 0;i < 100 - 1;i++){
            if(m[i] > m[i + 1]){
                temp = m[i];
                m[i] = m[i + 1];
                m[i + 1] = temp;

                k++;
            }
        }
        if(k == 0)
            break;
        k = 0;
    }

    for(int i = m_first;i < 100;i++){
        x -= m[i];
        ans++;
    }

    while(1){
        if(x - m[m_first] < 0){
            break;
        }
        x -= m[m_first];
        ans++;
    }

    std::cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main(){
    int a,b;
    cin >> a >> b;
    if(a<=b){
        F(i,0,b) cout << a;
        cout << endl;
    }
    else{
        F(i,0,a) cout << b;
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>

const double rad = (3.14159265 / 180);

int main(){

	int m, angle, sumangle = 0;
	double x = 0, y = 0;

	char c;

	while (std::cin >> m >> c >> angle, m || angle){

		x += (std::cos((90 - sumangle)*rad)*m);
		y += (std::sin((90 - sumangle)*rad)*m);
		sumangle += angle;
	}

	std::cout << (int)x << std::endl << (int)y << std::endl;

	return 0;
}

Measured memory_bytes: 1164
import bisect
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))

ans = 0
for b in B:
    ai = bisect.bisect_left(A, b)
    ci = bisect.bisect_right(C, b)
    ans += ai * (N-ci)
    #print(b,ai,ci)

print(ans)

Measured memory_bytes: 107108
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,y = iim()
for i in range(n+1):
    for j in range(n+1):
        k = n - i - j
        v = 10000*i+5000*j+1000*k
        if k >= 0 and v == y:
            print(i,j,k)
            exit()
print(-1,-1,-1)

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

int main() {
	ios_base::sync_with_stdio (false);
	cin.tie (0); cout.tie (0);
	string s;
	cin >> s;
	for (char c : s) {
		if (c == '7') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 a,b,c,d;
    cin >> a >> b >> c >> d;
    Yes((abs(a - b) <= d && abs(b - c) <= d) || abs(a - c) <= d);
    return 0;
}

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

#define int long long

int K, S, ans = 0;

signed main() {
    cin >> K >> S;
    for (int i = 0; i <= K; i++) {
        for (int j = 0; j <= K; j++) {
            if (S >= i + j && S - i - j <= K) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
    if a<b:
        a,b=b,a#swap(最初に確認のswap)
    while b>0:
        a=a%b
        a,b=b,a#(毎回入れ替えるawap)
    return a
A = list(map(int, input().split()))

print(gcd(A[0],A[1]))


Measured memory_bytes: 5600
let () =
  let open Queue in
  let (n:int),(quantum:int) = Scanf.scanf "%d %d\n" (fun a b -> a,b) in
  let (q:(string * int) t) = create () in
  for i=1 to n do
    add (Scanf.scanf "%s %d\n" (fun a b -> a,b)) q
  done;
  let (sum:int ref) = ref 0 in
  while not (is_empty q) do
    let p,t = take q in
    if t <= quantum then (sum := !sum+t; Printf.printf "%s %d\n" p !sum)
    else (add (p,t-quantum) q; sum := !sum+quantum)
  done

Measured memory_bytes: 12832
#include <stdio.h>
#include <stdlib.h>

#define MAX_N (200000)

int main(int argc, char *argv[]) {
  // read inputs
  int N, A, B, C, D;
  char cs[MAX_N + 1];
  scanf("%d %d %d %d %d", &N, &A, &B, &C, &D);
  A--;  // NOTE : modified input
  B--;  // NOTE : modified input
  C--;  // NOTE : modified input
  D--;  // NOTE : modified input
  scanf("%s", cs);
  // printf("%s\n", cs);

  // solve
  // check that there are no rocks next to each other
  int is_possible = 1;
  for (int i = A; i < C; i++) {
    if (cs[i] == '#' && cs[i + 1] == '#') {
      is_possible = 0;
    }
  }
  for (int i = B; i < D; i++) {
    if (cs[i] == '#' && cs[i + 1] == '#') {
      is_possible = 0;
    }
  }
  if (C > D) {
    // check that there is a open cell between B and D where
    // both adjacent cells are open
    int exists = 0;
    for (int i = B; i <= D; i++) {
      if (i - 1 >= 0 && i + 1 < N && cs[i - 1] == '.' && cs[i] == '.' &&
          cs[i + 1] == '.') {
        exists = 1;
      }
    }
    if (!exists) {
      is_possible = 0;
    }
  }

  // print answer
  if (is_possible) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include <algorithm>
#include<string.h>
#define ll long long
#define ull unsigned long long
using namespace std;
/* 
struct edge{
	int to, nxt;
}e[100005];
int head[100005], tot = 1, x, num[100005];
void add(int v, int u)
{
	e[tot].to = u, e[tot].nxt = head[v], head[v] = tot++;
}*/ 
ll a[200005];
ll n, k;
int bit(int l, int r, ll x, int d)
{
	while (l < r)
	{
		int mid = l + r >> 1;
		if (a[d] >= 0)
		{
			if (a[mid] * a[d] >= x)	r = mid;
			else l = mid + 1;
		}
		else
		{
			if (a[mid] * a[d] < x)	r = mid;
			else l = mid + 1;
		}
	}
	return l;
}
bool check(ll x)
{
	ll ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] < 0)
		{
			int od = bit(i + 1, n, x, i);
			ans += od - i - 1;
		}
		else if (a[i] > 0)
		{
			int od = bit(i + 1, n, x, i);
			ans += n - od;
		}
		else
		{
			if (x <= 0)
				ans += n - i - 1; 
		}
	}
	return n * (n - 1) / 2 - ans >= k;
}
signed main() 
{
	while (~scanf("%lld%lld", &n, &k))
	{
		for (int i = 0; i < n; i++)	scanf("%lld", a + i);
		a[n] = 1000000000000000100;
		sort(a, a + n);
		ll l = -1000000000000000005, r = 1000000000000000005;
		while (l < r)
		{
			ll m = l + r >> 1;
			if (check(m)) r = m;
			else	l = m + 1;
		}
		printf("%lld\n", l - 1);
	}
}


Measured memory_bytes: 1792
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
a=gsmi

ans=Array.new(n,0)
(n-1).downto(0) do |i|
  num=i+1
  cnt=0
  num.step(n,num) do |j|
    cnt+=ans[j-1]
  end
  ans[i]=1 if (a[i]+cnt)%2==1
end

a2=[]
ans.each.with_index do |a,i|
  a2<<i+1 if a==1
end

if a2.size.zero?
  puts 0
else
  puts "#{a2.size}\n#{a2.join(' ')}"
end

Measured memory_bytes: 23316
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

char s[1005][1005];
int main(void){
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++){
			if((i+j)%2==0){
				s[i][j] = '#';
			}else{
				s[i][j] = '.';
			}
		}
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		if(s[i][0] =='.'){
			ans ++;
			s[i][0] = 'x';
		}
		if(s[0][i] =='.'){
			ans++;
			s[0][i] = 'x';
		}
		if(s[N-1][i] =='.'){
			ans++;
			s[N-1][i] = 'x';
		}
	}
	for(int i=1;i<N-1;i++)
		if(i%3==0){
			for(int j=0;j<N;j++){
				if(s[i][j] =='.'){
					ans++;
					s[i][j] = 'x';
				}
			}
		}
	
	cout << ans << endl;
	for(int i=0;i<N;i++)for(int j=0;j<N;j++){
		if(s[i][j] =='x')cout << i << " " << j << endl;
	}
}

Measured memory_bytes: 2432
import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[] hills = new int[10];
		for (int i = 0; i < 10; i++) {
			hills[i] = in.nextInt() * -1;
		}
		Arrays.sort(hills);
		for (int i = 0; i < 3; i++) {
			System.out.println(hills[i] * -1);
		}
	}
}

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

string S,T;
void imput()
{
  cin >> S >> T;
}

void solve()
{
  T.pop_back();
  if(S == T) cout << "Yes" << endl;  
  else cout << "No" << endl;
}

int main()
{
  imput();
  solve();
}

Measured memory_bytes: 3616
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)

#def my_index_multi(l, x):
#    return [i for i, _x in enumerate(l) if _x == x]

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


def solve(S: str):
    ans=YES
    cent=len(S)//2
    for i in range(cent):
        if S[i] != S[-i-1]:
            ans = NO
        if S[i] != S[cent-i-1]:
            ans = NO

    print(ans)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
A = []
for _ in range(3):
  A.append(list(map(int, input().split())))
n = int(input())
b = []
for _ in range(n):
  b.append(int(input()))

result = []
for i in b:
  for j in range(0, 3):
    for k in range(0, 3):
      if A[j][k] == i:
        A[j][k] = "z"

z = "z"
if A[0][0] == z and A[1][1] == z and A[2][2] == z:
  print("Yes")
  exit()
if A[0][2] == z and A[1][1] == z and A[2][0] == z:
  print("Yes")
  exit()

for i in range(0, 3):
  if A[0][i] == z and A[1][i] == z and A[2][i] == z:
    print("Yes")
    exit()
  if A[i][0] == z and A[i][1] == z and A[i][2] == z:
    print("Yes")
    exit()
  
print("No")
  

Measured memory_bytes: 9280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 
#define PI 3.141592653589793238

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;
typedef gp_hash_table<long int,long int> HashTable;

int main(){
   IOS;
 /*    #ifndef ONLINE_JUDGE
         freopen("in.txt",  "r",  stdin);
         freopen("out.txt", "w", stdout);
     #endif */
   
   long int sum = 15;

   for(long int i = 0; i < 5; i++){
     long int x;
     cin>>x;
     sum -= x;
   }

   cout<<sum;
   return 0;
}

Measured memory_bytes: 3548
st=[1,1]
for i in range(10**5+1):
  st.append((st[-1]+st[-2])%1000000007)
st.append(0)
n,m=list(map(int,input().split()))
ret=1
x=-1
for i in range(m):
  y=int(input())
  ret=(ret*st[y-x-2])%1000000007
  x=y
ret=(ret*st[n-x-1])%1000000007
print(ret)

Measured memory_bytes: 7060