akhauriyash/Code-Regression huggingface dataset:
/*    _                     _     
  __| | _____   _____  ___| |__  
 / _` |/ _ \ \ / / _ \/ __| '_ \ 
| (_| |  __/\ V /  __/\__ \ | | |
 \__,_|\___| \_/ \___||___/_| |_|
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define faster       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define  endl    '\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define mpi         map<pair<ll int,ll int>,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define maxpq       priority_queue<ll>
#define minpq       priority_queue<ll, vector<ll>, greater<ll> >
#define F           first
#define S           second
#define rep(i,j,k)  for(int i=j;i<k;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define present(c,x) ((c).find(x) != (c).end())
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define what_is(x)  cout << #x << " is " << x << endl;
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }


using namespace std;
using namespace __gnu_pbds;
 
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
#define N  100005

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
 
int main(){
  faster
   int n;
   cin>>n;
   vector<double> dp(n+1,0);
   dp[0]=1;
   rep(i,0,n){
   	double p_head;
   	cin>>p_head;
   	for(int j=i+1;j>=0;--j){	
   		dp[j] = (j==0 ? 0 : dp[j-1]*p_head) + (1-p_head)*dp[j];


   	}

   }
      	double ans=0;
      	rep(i,0,n+1){
      		if(i>n-i)ans+=dp[i];
      	}
  cout<<setprecision(10);
  cout<<ans<<endl;
}




Measured memory_bytes: 3880
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	int N; cin >> N;
	for (int i = 0; i < N; ++i) {
		int K, P; cin >> K >> P;
		int ans = K%P;
		if (!ans)ans += P;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3080
n,m = map(int,input().split())
k = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))
import copy
def on(l):
    for i in range(m):
        num = k[i][0]
        s = k[i][1:]
        cnt = 0
        for j in s:
            if l[j-1]:
                cnt += 1
        if not cnt%2==p[i]:
            return False
    return True

def dfs(l,i):
    if i==n:
        if on(l):
            return 1
        return 0
    ret = 0
    l_ = copy.copy(l)
    l_[i] = 1
    ret += dfs(l,i+1)
    ret += dfs(l_,i+1)
    return ret

print(dfs([0]*n,0))

Measured memory_bytes: 3444
fn main() {
    proconio::input! {
        n: i128,
        x: i128,
        m: i128,
    }
    fn f(x: i128, m: i128) -> i128 {
        x % m
    }
    let mut a_s = vec![x];
    let mut map = std::collections::HashMap::new();
    map.insert(x, 0);
    for i in 1..n {
        let next = f(a_s.last().unwrap().pow(2), m);
        match map.get(&next) {
            Some(start) => {
                let end = i;
                let loop_indices = end - start;
                let loop_sum = a_s
                    .iter()
                    .skip(*start as usize)
                    .take(loop_indices as usize)
                    .sum::<i128>();
                let before_loop_sum = a_s.iter().take(*start as usize).sum::<i128>();
                let loop_times = (n - start) / loop_indices;
                let mod_indices = (n - start) % loop_indices;
                let mod_sum = a_s
                    .iter()
                    .skip(*start as usize)
                    .take(mod_indices as usize)
                    .sum::<i128>();
                let ans = before_loop_sum + loop_times * loop_sum + mod_sum;
                println!("{}", ans);
                return;
            }
            None => {
                map.insert(next, i);
            }
        }
        a_s.push(next);
    }
    let ans = a_s.iter().sum::<i128>();
    println!("{}", ans);
}


Measured memory_bytes: 5516
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> arr(3*n);
  for(int i=0;i<3*n;i++){
      cin >>arr.at(i);
  }
  sort(arr.begin(),arr.end());
  reverse(arr.begin(),arr.end());
  int64_t sum=0;
  for(int i=1;i<2*n;i+=2){
    sum+=arr.at(i);
  }
  cout<<sum;
  return 0;
}


Measured memory_bytes: 4236
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi a,b;

int main(){
	cin>>n;
	a=b=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	int res=0;
	for(int i=0;i<n;i++) res+=max(0,a[i]-b[i]);
	cout<<res<<endl;
}

Measured memory_bytes: 256
import numpy as np

MOD = 10**9+7

n = int(input())
arr = np.zeros((n+1,n+1), dtype=int)
for i in np.arange(3,n+1):
    arr[0,i] = 1

for i in np.arange(1,n+1):
    sum_ = 0
    for j in np.arange(3*i,n+1):
        sum_ += arr[i-1,j]
        sum_ %= MOD
        if j+3 >= n + 1:
            break
        arr[i,j+3] = sum_

ans = 0
for i in range(n+1):
    ans += arr[i,n]
    ans %= MOD
print(ans)








Measured memory_bytes: 33940
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

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

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	Left := []int{}
	Right := []int{}
	pos := ""
	if N%2 == 0 {
		pos = "right"
	} else {
		pos = "left"
	}
	for i := 0; i < N; i++ {
		if pos == "right" {
			Right = append(Right, A[i])
			pos = "left"
		} else {
			Left = append(Left, A[i])
			pos = "right"
		}
	}
	for i := len(Left) - 1; i >= 0; i-- {
		fmt.Fprint(wtr, Left[i], " ")
	}
	for i := 0; i < len(Right); i++ {
		fmt.Fprint(wtr, Right[i])
		if i != len(Right)-1 {
			fmt.Fprint(wtr, " ")
		}
	}
	fmt.Fprintln(wtr)
	wtr.Flush()
}


Measured memory_bytes: 12288
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 600
int dirx[] = {1, -1,0, 0, 1, 1, -1, -1}, diry[] = {0, 0, 1, -1, 1, -1, 1, -1};



//=============================================ASIFAZAD==============================================//

bool cmp(int a, int b)
{
    return abs(a) > abs(b);
}

int32_t main()
{
    io;
    int n;
    cin>>n;
    cout<<1-n;
    return 0;
}



Measured memory_bytes: 3648
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
vector<P> city[100001];

void dispY(int yLen)
{
	if (0 < yLen) {
		REP(i, yLen) {
			cout << "U";
		}
	} else {
		REP(i, yLen * -1) {
			cout << "D";
		}
	}
}

void dispX(int xLen)
{
	if (0 < xLen) {
		REP(i, xLen) {
			cout << "R";
		}
	} else {
		REP(i, xLen * -1) {
			cout << "L";
		}
	}
}

int main()
{
	string S;
	cin >> S;

	int diff = INF;
	int sVal;
	string sStr;
	REP(i, S.size() - 2) {
		sStr = S.substr(i, 3);
		sVal = atoi(sStr.c_str());
		diff = min(diff, abs(sVal - 753));
	}
	cout << diff << endl;
	return 0;
}


Measured memory_bytes: 2560
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

#define rr register
#define INF 1e18
#define LINF -1e18

using namespace std;

const int MAXN = 1e5 + 1;

inline int read() {
	int s = 0, m = 0;
	char ch = getchar();
	while (!isdigit(ch)) {m |= ch == '-', ch = getchar();}
	while (isdigit(ch)) {s = s * 10 + (ch ^ 48), ch = getchar();}
	return m ? -s : s;
}

int n, a, b, t;

signed main(int argc, char const *argv[]) {
	n = read();
	a = read();
	b = read();
	t = (a * n) < b ? (a * n) : b;
	cout << t;
	return 0;
}

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

using namespace std;

long long int calc( string S ) {
	long long int ret = stoll( S );
	for( size_t i = 1; i < S.size(); i++ ) {
		long long int memo = 0;
		auto Sx = S.substr( 0, i );
		ret += stoi( Sx )*powl( 2, S.size() - i-1 );
		auto Sy = S.substr( i, S.size() - i );
		ret += calc( Sy );
		//cout << Sx << " " << Sy << endl;

	}
	return ret;
}

int main() {
	string S;
	cin >> S;
	cout << calc( S ) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 1; i < n - 1; ++i) {
        if(a[i] < a[i + 1] && a[i] < a[i - 1] || a[i] > a[i + 1] && a[i] > a[i - 1]) {

        }else ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.*
import java.util.*

fun solve(N: Int, v: IntArray){
    val queue = PriorityQueue<Double>()
    v.forEach{ queue.offer(it.toDouble()) }
    repeat(N-1){
        val a = queue.poll()
        val b = queue.poll()
        queue.offer((a+b)/2)
    }
    println(queue.poll())
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val v = IntArray(N)
    for (i in 0 until N) {
        v[i] = sc.next().toInt()
    }
    solve(N, v)
}



Measured memory_bytes: 31392
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll a, b;
    cin >> a >> b;
    string ans = abs(a - b) <= 1 ? "Yay!" : ":(";
    cout << ans << endl;
    return 0;
}

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

int main() {
	long long N, M;
	string S;
	vector<long long> ANS;
	cin >> N >> M >> S;
	reverse(S.begin(), S.end());
	long long NOW = 0;
	while (NOW != N) {
		long long check = true;
		for (int i = M; i >= 1; i--) {
			if (i + NOW > N) continue;
			else if (S[i + NOW] == '0') {
				ANS.push_back(i);
				check = false;
				NOW += i;
				break;
			}
		}
		if (check) {
			cout << -1 << endl;
			return 0;
		}
	}
	reverse(ANS.begin(), ANS.end());
	for (int i = 0; i < ANS.size(); i++) {
		if (i != 0) cout << " ";
		cout << ANS[i];
	}
	cout << endl;
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (ll)(1E9+7)
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}



int main() {
	string right="yuiophjklnm";
	string input;
	while(1){
	    cin>>input;
	    vi v;
	    int ans=0;
	    if(input=="#") break;
	    for(int i=0;i<input.size();i++){
	        string tmp=input.substr(i,1);
	        //cout<<"*"<<right.find(tmp)<<endl;
            if(right.find(tmp)<=right.size()){
                v.push_back(1);
            }else{
                v.push_back(-1);
            }
	    }
	    //cout<<v<<endl;
	    for(int i=1;i<input.size();i++){
	        if(v[i]*v[i-1]<0){
	            ans++;
	        }
	    }
	    cout<<ans<<endl;
	}
}



Measured memory_bytes: 3136
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>

#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#include <utility>
#include <list>

#include <cmath>
#include <algorithm>
#include <cassert>
#include <bitset>
#include <complex>
#include <climits>
#include <functional>
#include <unordered_set>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;
typedef pair<double, double> dd;
#define mp make_pair
#define pb push_back

#define debug(x) cerr << #x << " = " << x << " "
map<int, int> cnt;
int n;
bool ans()
{
  if (cnt.size() > 2) return false;
  if (cnt.size() == 1) return cnt.begin()->first == n-1 || 2 * (cnt.begin()->first) <= n;
  int mini = cnt.begin()->first;
  int maxi = cnt.rbegin()->first;
  if (mini != maxi-1) return false;
  int left_color = maxi - cnt.begin()->second;
  if (left_color <= 0) return false;
  int left = cnt.rbegin()->second;
  return 2 * left_color <= left;
}

int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    {
      int x; scanf("%d", &x);
      ++cnt[x];
    }
  puts(ans()?"Yes":"No");
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long int
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int32_t main()
    {
        IOS;
        ll k,l,n,m,q,m1,m2,flag=0,cnt,flag2,flag3,cnt2,sum=0,i,j;
       cin>>n;
       string s;
       cin>>s;
       for(i=0;i<n;i++)
       {
           if(s[i+1]!=s[i])
           {
               sum++;
           }
           else
           {
               continue;
           }
       }
       cout<<sum;




        return 0;

    }


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main(){
  int64_t A, V, B, W, T;
  cin >> A >> V;
  cin >> B >> W;
  cin >> T;
  if(W >= V){
    cout << "NO" << endl;
  }
  else if(abs(A - B) <= (V - W) * T){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  } 
}

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


int main(){
    int64_t N,Q,a,b,c;
    int64_t sum = 0;
    cin >> N;
    vector<int64_t> A(N);
    vector<int64_t> cnt(100001,0);
    for(int64_t i = 0; i < N; i++){
        cin >> a;
        A.at(i) = a;
        cnt.at(a) += 1;
        sum += a;
    }
    cin >> Q;
    vector<int64_t> B(Q);
    vector<int64_t> C(Q);
    for(int64_t j = 0; j < Q; j++){
        cin >> B.at(j) >> C.at(j);
        b = B.at(j);
        c = C.at(j);
        cnt.at(c) += cnt.at(b);
        sum = sum + (c-b)*cnt.at(b);
        cnt.at(b) = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 6292
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;

constexpr int INF       = 1000000000;/* 1e+9a */
constexpr int MODULO    = 1000000007;

typedef int64_t ll;

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

#define SPRE(x) setprecision(x) // 精度を指定

int main()
{
	cin.tie(0);
    ios::sync_with_stdio(false);
	int n;
	int odd = 0, even=0;
	cin >> n;
	for(int i = 0; i < n; ++i)
	{
		int tmp;
		cin >> tmp;
		if(tmp % 2)
			odd++;
		else
			even++;
	}
	cout << (odd % 2 ? "NO\n" : "YES\n");
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
const int maxn=200005;
struct bag{
    int x,y;
}p[maxn];
bool operator < (bag a,bag b){
    if(a.x==b.x)return a.y<b.y;
    return a.x<b.x;
}
int n,Rmax,Rmin,Bmax,Bmin;
int main(){
    long long ans=1e18;
    scanf("%d",&n);
    if(n==1){
        cout<<0<<endl;return 0;
    }
    for(int i=0;i<n;i++){
        scanf("%d%d",&p[i].x,&p[i].y);
        if(p[i].x>p[i].y){
            int k=p[i].x;
            p[i].x=p[i].y;
            p[i].y=k;
        }
    }
    sort(p,p+n);
    int Max=p[0].y,Min=p[0].x,_max=0,_min=0;
    for(int i=1;i<n;i++){
        if(p[i].x<=Min&&p[i].y>=Max){
            Min=p[i].x;Max=p[i].y;
            _max=i;_min=i;
        }
        else if(p[i].x<Min){
            Min=p[i].x;
            _min=i;
        }else if(p[i].y>Max){
            Max=p[i].y;
            _max=i;
        }
    }
    Rmax=Max;Bmin=Min;
    Rmin=p[_min].y;Bmax=p[_max].x;
    for(int i=0;i<n;i++){
        Rmin=min(Rmin,p[i].y);
        Bmax=max(Bmax,p[i].x);
    }
    ans=(long long)(Rmax-Rmin)*(Bmax-Bmin);
    if(_max!=_min){
        Bmax=Max;Bmin=Min;
        Rmax=max(p[n-1].x,p[0].y);
        int premin=p[0].y;
        Rmin=min(p[0].y,p[1].x);
        //sort(p,p+n);
        long long ans0=Rmax-Rmin;
        for(int i=1;i<n-1;i++){
            Rmax=max(p[i].y,Rmax);
            Rmin=min(min(premin,p[i].y),p[i+1].x);
            premin=min(premin,p[i].y);
            if(Rmax-Rmin<ans0)ans0=Rmax-Rmin;
        }
        ans0*=Bmax-Bmin;
        ans=min(ans,ans0);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
    int a, b, c, k, i, max, ans, tmp;
    scanf("%d %d %d %d", &a, &b, &c, &k);
    
    max = a-b>=0 ? a : b;
    max = c-max>=0 ? c : max;
    tmp = max;
    for(i=0; i<k; i++) {
        max *= 2;
    }
    if(tmp==a)
        ans = max + b + c;
    else if(tmp==b)
        ans = max + c + a;
    else
        ans = max + a + b;
    
    printf("%d", ans);
    return 0;
}


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

int main(void){
    int N;
    cin >> N;
    int D[N];
    rep(i,N) cin >> D[i];
    sort(D,D+N);
    int M;
    cin >> M;
    int T[M];
    rep(i,M) cin >> T[i];
    sort(T,T+M);
    bool ans=true;
    int now=-1;
    rep(i,M){
        now++;
        while(T[i]!=D[now] && now<N) now++;
        if(now==N) ans=false;
        if(!ans) break;
    }
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>

using namespace std;

int main()
{
	string s,ans="No";

	cin >> s;

	if (s.size() % 2 == 0)
		for (long long i = 0; i < s.size(); i++)
			if (i % 2 == 1)
			{
				if (s[i-1] == 'h' && s[i] == 'i')
					ans = "Yes";
				else
					ans = "No";
			}

	cout << ans<< endl;
}

Measured memory_bytes: 256
# ?´???°?????°?????¨?????????????????°??????

import sys
import math

prim_no = {2: True}                    # ????????°????´???°??§??????????????????????????????

def is_prime(no):
    if no == 2 or no == 1:
        return True
    
    if no % 2 == 0:
        return False

    if prim_no.get(no) is not None:
        return prim_no.get(no)

    max_check = int(math.sqrt(no))
    for i in range(3, max_check+1, 2):
        if no % i == 0:
            prim_no[no] = False
            return False

    prim_no[no] = True
    return True

def main():
    prim_vals = {}                         # ????????°?????§????´???°????????°
    num_data = []                          # ?????????????????????
    
    while True:
        num = sys.stdin.readline()
        if num is None or num.strip() == '':
            break

        num = int(num.strip())
        num_data.append(num)

    sorted_num_data = sorted(num_data)
    prim_num = {}
    
    for num in sorted_num_data:
        if prim_vals.get(num) is not None:
            cnt = prim_vals.get(num)
        else:
            if num == 1:
                cnt = 0
            else:
                cnt = 0

                if num % 2 == 0:
                    start_num = num -1
                else:
                    start_num = num
                    
                for i in range(start_num, 0, -2):
                    if prim_vals.get(i) is not None:
                        cnt += prim_vals.get(i)
                        break
                    
                    if is_prime(i):
                        cnt += 1
                        
                prim_vals[num] = cnt # ????????°?????§????´???°????????°????????????
        prim_num[num] = cnt

    for num in num_data:
        print(prim_num[num])

if __name__ == '__main__':
    main()
    #print(prim_no)

Measured memory_bytes: 55568
#include <iostream>
using namespace std;
int main(void){
    int n;
    int K[1500]={0};
    int P[1500]={0};
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> K[i] >> P[i];
    }
    
    for(int i=1;i<=n;i++){
        int x=K[i]%P[i];
        if(x==0){
            cout << P[i] << endl;
        }
        else{
            cout << x << endl;
        }
    }
}



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

using ll = long long;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)

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

	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int n,m,k;
	cin>>n>>m>>k;

	vector<int> A,B;

	for(int i=0; i<n; i++)
	{
		int a;
		cin>>a;
		A.push_back(a);
	}

	for(int i=0; i<m; i++)
	{
		int b;
		cin>>b;
		B.push_back(b);
	}

	ll total_read = 0LL;
	int cur_ans=0;

	for(int i=0; i<n; i++)
	{
		total_read += A[i];
		cur_ans++;
	}

	int b_index = 0;

	while(b_index<m && total_read + ll(B[b_index]) <= ll(k))
	{
		cur_ans++;
		total_read+=B[b_index];
		b_index++;
	}

	int ans = 0;
	if(total_read <= ll(k)) ans = cur_ans;

	for(int i=n-1; i>=0; i--)
	{
		total_read -= A[i];
		cur_ans--;

		// cout << i << " " << total_read << endl;

		while(b_index<m && total_read + ll(B[b_index]) <= ll(k))
		{
			cur_ans++;
			total_read+=B[b_index];
			b_index++;
		}

		if(total_read <= ll(k)) ans=max(ans,cur_ans);
	}

	cout << ans << endl;
}

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

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

    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s.at(i);
    }

    map<string, int> x;
    for (int i = 0; i < n; i++) {
        x[s.at(i)] = 1;
    }
    cout << x.size() << endl;
}

Measured memory_bytes: 25020
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;

struct UnionFind{
    vector<int> parent;
    vector<int> rank;
    UnionFind(int n):parent(n),rank(n){
        for (int i=0;i<n;i++){
            parent[i]=i;
            rank[i]=0;
        }
    }
    int root(int x){
        if (parent[x]==x)return x;
        return parent[x]=root(parent[x]);
    }
    void unite(int x, int y){
        int rx=root(x);
        int ry=root(y);
        if (rx==ry)return;
        if (rank[rx]<rank[ry]) parent[rx]=ry;
        else{
            parent[ry]=rx;
            if (rank[rx]==rank[ry]) rank[rx]++;
        }
    }
    bool same(int x, int y){
        return root(x)==root(y);
    }
};

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<pair<int,int>> X(n),Y(n); 
    vector<pair<int,pair<int,int>>> edge;
    UnionFind uf(d5);
    for(int i=0;i<n;i++){
        cin>>X[i].first>>Y[i].first;
        X[i].second=Y[i].second=i;
    }
    sort(All(X));
    sort(All(Y));
    for(int i=0;i<n-1;i++){
        edge.push_back(make_pair(abs(X[i].first-X[i+1].first),make_pair(X[i].second,X[i+1].second)));
        edge.push_back(make_pair(abs(Y[i].first-Y[i+1].first),make_pair(Y[i].second,Y[i+1].second)));
    }
    sort(All(edge));
    int res = 0;
    for (auto e : edge) {
        int u = e.second.first;
        int v = e.second.second;
        int cost = e.first;
        if (uf.same(u,v))continue;
        uf.unite(u,v);
        res += cost;
    }
    cout << res << endl;
}

Measured memory_bytes: 13296
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
using namespace std;

const int INF = INT_MAX;

struct seg_t {
  int size;
  vector<int> data;
  int pool_size;
  vector<int> pool;
  seg_t(int n) {
    int i = 1;
    while(i * i < n) i++;
    size = i * i;
    pool_size = i;
    data.assign(size, INF);
    pool.assign(pool_size, INF);
  }
  void update(int k, int x) {
    data[k] = x;
    int pool_k = k / pool_size;
    pool[pool_k] = INF;
    for(int i = pool_k * pool_size; i < (pool_k + 1) * pool_size; i++) {
      pool[pool_k] = min(pool[pool_k], data[i]);
    }
  }
  int minimum(int a, int b) {
    int pool_a = a / pool_size;
    int pool_b = b / pool_size;
    if(pool_a == pool_b) {
      int minvalue = INF;
      for(int i = a; i < b; i++) {
        minvalue = min(minvalue, data[i]);
      }
      return minvalue;
    }
    else {
      int minvalue = INF;
      for(int i = a; i < (pool_a + 1)*pool_size; i++) {
        minvalue = min(minvalue, data[i]);
      }
      for(int i = pool_a + 1; i < pool_b; i++) {
        minvalue = min(minvalue, pool[i]);
      }
      for(int i = pool_b*pool_size; i < b; i++) {
        minvalue = min(minvalue, data[i]);
      }
      return minvalue;
    }
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  seg_t r(n);
  for(int i = 0; i < q; i++) {
    int c, x, y; cin >> c >> x >> y;
    if(c == 0) r.update(x,y);
    else {
      cout << r.minimum(x,y+1) << endl;
    }
  }
}

Measured memory_bytes: 1524
if __name__ == '__main__':
    # ??????????????\???
    duration = int(input())     # ????????????(???)
    cars_in_tunnel = int(input())  # ??????????????????????????°
    data = []                   # 1????????¨????????\???????????????
    for _ in range(duration):
        data.append([int(x) for x in input().split(' ')])

    # ???????????????
    max_cars = cars_in_tunnel   # ???????????????????????????????????§??°
    error_detected = False      # ??????????????????????????°???????????????????????£???????????????
    for car_in, car_out in data:
        cars_in_tunnel += car_in
        cars_in_tunnel -= car_out
        if cars_in_tunnel < 0:
            error_detected = True
            break
        else:
            max_cars = max(max_cars, cars_in_tunnel)

    # ???????????¨???
    if error_detected is False:
        print(max_cars)
    else:
        print(0)

Measured memory_bytes: 8704
#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順
#include <map>

using namespace std;
using ll = long long int;

int main(){
    ll A;cin>>A;
    long double b;cin>>b;
    ll B = b*100.0+0.5;
    ll ans = A*B/100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3704
A,B,C= map(int, input().split())
cot = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    else:
        tempA = (B + C)//2
        tempB = (A + C)//2
        tempC = (B + A)//2
        A = tempA
        B = tempB
        C = tempC
        cot += 1

        if cot > 1000000:
            print(-1)
            exit(0)
            
print(cot)

Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,M,A[100010],C[100010];
    long long sum=0,B[100010];
    cin>>N>>M;
    for(int i=0;i<N;++i)cin>>A[i];
    sort(A,A+N);
    
    map<int,long long> mp;
    priority_queue<int> pq;
    pq.push(0);
    for(int i=0;i<M;++i){
        cin>>B[i]>>C[i];
        mp[C[i]]+=B[i];
    }
    sort(C,C+M);
    pq.push(C[0]);
    for(int i=1;i<M;i++){
        if(C[i]>pq.top())pq.push(C[i]);
    }
    
    for(int i=0;i<N;i++){
        if(pq.top()>A[i]){
            A[i]=pq.top();
            mp[pq.top()]--;
            if(mp[pq.top()]==0)pq.pop();
        }
        else break;
    }
    

    for(int i=0;i<N;++i)
        sum+=A[i];
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <bitset>
const int N = 100005;
using namespace std;
typedef long long ll;
int a[N];
int n;
bitset<4000010> f;
int main()
{
    int i,j,k=0;
    scanf("%d",&n);
    f[0]=1;
    for(i=1;i<=n;i++)  //得到n个数构成的集合f,有则为1,无则为0
      {
       scanf("%d",&j);
       f=f|(f<<j);
       k+=j;
       //printf("%d\n",f);
      }
      /*for(int i=1;i<=k;i++)
      {
          if(f[i]==0)
            printf("0\n");
          else
            printf("1\n");
      }*/
    for(i=(k+1)/2;!f[i];i++);//从总值的一半开始找
    printf("%d\n",i);
    return 0;
}


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

typedef tuple<int, int, int> T;
int X, Y, N;
char mat[1001][1001];
int sx[10];
int sy[10];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int bfs(int x, int y, int n) {
    auto Q = queue<T>();
    Q.push(make_tuple(x, y, 0));
    int t;
    while (!Q.empty()) {
        tie(x, y, t) = Q.front(); Q.pop();
        if (x == sx[n+1] && y == sy[n+1]) {
            return t;
        }
        for (int i=0; i<4; ++i) {
            int xx = x + dx[i];
            int yy = y + dy[i];
            if (0 <= xx && xx < X && 0 <= yy && yy < Y && mat[xx][yy] != 'X' && mat[xx][yy] != '0' + n) {
                mat[xx][yy] = '0' + n;
                Q.push(make_tuple(xx, yy, t+1));
            }
        }
    }
    return -1;
}

int main() {
    cin >> X >> Y >> N;

    for (int i=0; i<X; ++i) {
        for (int j=0; j<Y; ++j) {
            cin >> mat[i][j];
            if (mat[i][j] == 'S') {
                sx[0] = i, sy[0] = j;
            }
            if ('1' <= mat[i][j] && mat[i][j] <= '9') {
                sx[mat[i][j] - '0'] = i; 
                sy[mat[i][j] - '0'] = j; 
            }
        }
    }
    
    int res = 0;
    for (int i=0; i<N; ++i) {
        res += bfs(sx[i], sy[i], i);
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 4116
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String colorA = sc.next();
		String colorB = sc.next();
		int numA = sc.nextInt();
		int numB = sc.nextInt();
		String colorC = sc.next();

		if (colorC.equals(colorA)) {
			numA--;
		} else if (colorC.equals(colorB)) {
			numB--;
		}

		System.out.println(numA + " " + numB);

	}
}

Measured memory_bytes: 38852
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        long e = sc.nextLong();


        long min = Math.min(a,b);
        min = Math.min(min, c);
        min = Math.min(min, d);
        min = Math.min(min, e);

//        long minute = n/min+1;
        long minute=0;
        
        if (n%min==0){
            minute = n/min;
        }else{
            minute = n/min+1;
        }

        System.out.println(minute+4);

    }

}

Measured memory_bytes: 23764
#include <iostream>
using namespace std;
int n;
int main()
{
    cin>>n;
    n=n%10;
    if(n==3)
    cout<<"bon"<<"\n";
    else if(n==0||n==1||n==6||n==8)
    cout<<"pon"<<"\n";
    else 
    cout<<"hon"<<"\n";
}

Measured memory_bytes: 3636
# 1. swap a and b
# 2. swap a and c
ints = list(map(int, input().split()))
ints[0], ints[1] = ints[1], ints[0]
ints[0], ints[2] = ints[2], ints[0]

print(" ".join([ str(e) for e in ints]))

Measured memory_bytes: 3064
n = str(input())
if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9056
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int h,w;

bool in(int x, int y){
    if(x < 0 || x >= h)return false;
    if(y < 0 || y >= w)return false;
    return true;
}

int main(void) {
    int i,j,k;
    while(cin >> w >> h, h){
        int g[30][30];
        rep(i,h)rep(j,w) cin >> g[i][j];
        vi c(4);
        rep(i,4)cin >> c[i];
        int cost[30][30][4];//up,right,down,left
        rep(i,h)rep(j,w)rep(k,4)cost[i][j][k] = INF;
        cost[0][0][1] = 0;
        queue<vi> q;
        vi v(3);
        v[0] = v[1] = 0;
        v[2] = 1;
        q.push(v);
        int dx[4] = {-1,0,1,0};
        int dy[4] = {0,1,0,-1};
        while(q.size()){
            vi t = q.front();
            q.pop();
            int x = t[0];
            int y = t[1];
            int z = t[2]; //up,right,down,left
            int d = g[x][y];
            rep(i,4){
                t[0] = x + dx[(z+i)%4]; // x
                t[1] = y + dy[(z+i)%4]; // y
                t[2] = (z + i)%4; // up,right,down,left
                if(!in(t[0],t[1]))continue;
                if(i == d){
                    if(cost[t[0]][t[1]][t[2]] > cost[x][y][z]){
                        cost[t[0]][t[1]][t[2]] = cost[x][y][z];
                        q.push(t);
                    }
                }else{
                    if(cost[t[0]][t[1]][t[2]] > cost[x][y][z] + c[i]){
                        cost[t[0]][t[1]][t[2]] = cost[x][y][z] + c[i];
                        q.push(t);
                    }
                }
            }
        }
        int ans = INF;
        rep(i,4) ans = min(ans, cost[h-1][w-1][i]);
        cout << ans << endl;

    }
}



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

int main(void){
  int n;
  deque<int> deq;
  
  cin >> n;
  for (int i=0; i<n; i++){
    int q;
    cin >> q;
    if (q==0){
      int d, x;
      cin >> d >> x;
      if (d==0) deq.push_front(x);
      else deq.push_back(x);
    } else if (q==1){
      int p;
      cin >> p;
      cout << deq[p] << endl;
    } else { // q==2
      int d;
      cin >> d;
      if (d==0) deq.pop_front();
      else deq.pop_back();
    }
  }
  //cout << ans << endl;
  return 0;
}


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

int main()
{
  string s;
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < 4; ++i)
    if (s[i] == '+')
      cnt++;
    else
      cnt--;
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1010,maxs=25000,maxp=3000;
int n,m,ans;
int prim[maxp],pcnt;
bool isp[maxs];
inline int mymax(int a,int b){
    return a>b?a:b;
}
void fil(){
    memset(isp,1,sizeof(isp));
    isp[0]=isp[1]=false;
    for(register int i=2;i<maxs;i++) if(isp[i]){
        prim[++pcnt]=i;
        for(register int j=i*i;j<maxs;j+=i) isp[j]=false;
    }
}
int main(){
    scanf("%d%d",&n,&m);fil();
    if(n==1){
        printf("%d\n",m);
        return 0;
    }
    for(register int i=1;(i*i<=m)&&(m/i>=n);i++) if(!(m%i)){
        if(i>=n) ans=mymax(ans,m/i);
        ans=mymax(ans,i);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

int b,w;

ll powll(ll base,ll power){
    ll ans = 1;
    while (power){
        if (power&1) ans = (base*ans)%mod;
        base = (base*base)%mod;
        power >>= 1;
    }
    return ans;
}
ll facts[200020],invs[200020];
ll ncr(int n, int r){
    return (facts[n] * invs[r] % mod) * invs[n-r] % mod;
}

int bi,mi,wi;
signed main(){

    I(b); I(w);
    int n = b+w;
    ll f = 1;
    facts[0] = 1;
    FOR(i,1,n+1){
        f *= i;
        f %= mod;
        facts[i] = f;
    }
    ll inv = powll(f,mod-2);
    invs[n] = inv;
    REPNS(i,n){
        inv *= i;
        inv %= mod;
        invs[i-1] = inv;
    }

    int bumbo = 1; // 2で割っていく
    int twoinv = powll(2,mod-2);
    mi = 1;
    int sm = 1; // 2で掛けてく
    REPS(i,n){
        int ret = (bi*bumbo)%mod;
        bumbo = (bumbo * twoinv)%mod;
        ret = (ret + mi*bumbo) % mod;


        // cerr << wi << " " << mi << " " << bi << endl;
        printf("%lld\n", ret);

        bi *= 2;
        wi *= 2;
        sm *= 2;
        if (i >= w) bi += ncr(i-1,w-1);
        if (i >= b) wi += ncr(i-1,b-1);
        bi %= mod;
        wi %= mod;
        sm %= mod;
        mi = (sm - bi - wi) % mod;
        if (mi < 0) mi += mod;
    }

}

Measured memory_bytes: 5376
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);
    
    string S;
    cin >> S;

    bool ok = true;
    if (S.length() % 2 != 0) {
        ok = false;
    } else {
        rep(i, S.length()) {
            if (i % 2 == 0) {
                if (S[i] != 'h') {
                    ok = false;
                }
            } else {
                if (S[i] != 'i') {
                    ok = false;
                }
            }
        }
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


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

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


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

using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 55;
struct node {
    int v, a, b;
};
vector<node> G[N];
int c[N], d[N];
ll f[N][N * N];

int main() {
    int n, m, s;
    scanf("%d%d%d", &n, &m, &s), s = min(s, 2500);
    for (int i = 1; i <= m; i++) {
        int u, v, a, b;
        scanf("%d%d%d%d", &u, &v, &a, &b);
        G[u].push_back({v, a, b});
        G[v].push_back({u, a, b});
    }
    for (int i = 1; i <= n; i++) {
        scanf("%d%d", &c[i], &d[i]);
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N * N; j++) {
            f[i][j] = 1e18;
        }
    }
    f[1][s] = 0;
    typedef tuple<ll, int, int> T;
    priority_queue<T, vector<T>, greater<T> > qu;
    qu.push(T(0, 1, s));
    while (!qu.empty()) {
        ll t = get<0>(qu.top());
        int u = get<1>(qu.top()), w = get<2>(qu.top());
        qu.pop();
        if (f[u][w] > t)continue;
        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i].v, a = G[u][i].a, b = G[u][i].b;
            if (w >= a && f[v][w - a] > t + b) {
                f[v][w - a] = t + b;
                qu.push(T(t + b, v, w - a));
            }
        }
        if (f[u][min(w + c[u], 2500)] > t + d[u]) {
            f[u][min(w + c[u], 2500)] = t + d[u];
            qu.push(T(t + d[u], u, min(w + c[u], 2500)));
        }
    }
    for (int i = 2; i <= n; i++) {
        ll ans = 1e18;
        for (int j = 0; j <= 2500; j++) {
            ans = min(ans, f[i][j]);
        }
        printf("%lld\n", ans);
    }
    return 0;
}

Measured memory_bytes: 6584
num = []
while True:
    a = input()
    if a == '0':
        break
    num.append(a)
ans = []
tmp = 0
for i in range(len(num)):
    tmp = 0
    for j in range(len(num[i])):
        tmp += int(num[i][j])
    
    ans.append(tmp)

for i in range(len(num)):
    print(ans[i])


Measured memory_bytes: 5620
import sys

N = int(input())

def search(n, ans):
    if n > N:
        return ans
    if ('3' in str(n)) and ('5' in str(n)) and ('7' in str(n)):
        ans += 1
    ans = search(int(str(n)+'3'),ans)
    ans = search(int(str(n)+'5'),ans)
    ans = search(int(str(n)+'7'),ans)
    return ans

print(search(0, 0))

Measured memory_bytes: 3064