akhauriyash/Code-Regression huggingface dataset:
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// ??\??????push_back(d)???array[d]???????????????1?????§?????????
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN(){T d;cin>>d;return d;}
// ?????§??¬?´???°???Greatest Common Divisor???
LL gcd(LL a, LL b){ return (b > 0) ? gcd(b, a%b) : a; }
// ????°???¬?????°???Least Common Multiple???
LL lcm(LL a, LL b){ return a / gcd(a, b) * b; }

// ------------------- include, typedef, define END. -------------------

LL oh_no_plus(LL now){
	LL afterPlus=0;
	// 5% ???????????????????????????
	afterPlus = now + now*0.05;
	// ?????????????????? 1,000 ??????????????????????????????
	afterPlus = ceil(afterPlus/1000.0);
	return afterPlus * 1000;
}

int main(){
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;
	
	//??????????????????????????????.
	int n;
	while(cin>>n){
		LL ans = 100000;
		FOR(i,0,n){
			ans = oh_no_plus(ans);
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1188
import scala.io.StdIn._

object Main extends App {

  val Array(n,m) = readLine().split(" ").map(_.toInt)
  val AB = Array.fill(n)(readLine().split(" ").map(_.toLong))

  def solve() = {
    var drinks = 0L
    var spend = 0L
    val sortedAB = AB.sortBy(list => list(0))
    sortedAB.foreach { list =>
      if(drinks < m) {
        val price = list(0)
        val stock = list(1)
        val buyCnt = Math.min(m-drinks, stock)
        spend += buyCnt * price
        drinks += buyCnt
      }
    }
    spend
  }
  println(solve())

}



Measured memory_bytes: 61944
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	String str= sc.next();
      	char tmp;
      	String output="";
      	for(int i=0;i<str.length();i++)
        {
          	tmp=str.charAt(i);
          	
          	if(64<(byte)tmp && (byte)tmp<91)
            {
              	if((byte)tmp+a>90)
                {
                  output=output+(char)((byte)tmp+a-26);
                }
      			else
                {
                  output=output+(char)((byte)tmp+a);
                }
            }          	
        }
      	System.out.println(output);
	}
}

Measured memory_bytes: 146260
<?php
const MOD = 10 ** 9 + 7;
list($n, $k) = ints();
$a = ints();
if ($k === 1) exit('0');
init($n);
rsort($a);
$cusum[0] = 0;
for ($i = 0; $i < $n; ++$i) $cusum[$i + 1] = $cusum[$i] + $a[$i];
$ans = 0;
for ($i = 0; $i <= $n - $k; ++$i) {
    $sumMaxX = $cusum[$n - $k + 1 - $i];
    $sumMinX = modSub($cusum[$n], $cusum[$i + $k - 1]);
    $sumF = modSub($sumMaxX, $sumMinX);
    $ans = modAdd($ans, modMul($sumF, nCr2($k + $i - 2, $k - 2)));
}
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}

// 足し算
function modAdd($x, $y)
{
    return ($x + $y) % MOD;
}

// SUM
function modSum(...$xs)
{
    $res = 0;
    foreach ($xs as $x) $res = modAdd($res, $x);
    return $res;
}

// 引き算
function modSub($x, $y)
{
    return ($x + MOD - $y) % MOD;
}

// 掛け算
function modMul($x, $y)
{
    return ($x * $y) % MOD;
}

// PRODUCT
function modProd(...$xs)
{
    $res = 1;
    foreach ($xs as $x) $res = modMul($res, $x);
    return $res;
}

// 割り算
function modDiv($x, $y)
{
    return modMul($x, modPow($y, MOD - 2));
}

// 累乗（繰り返し二乗法）
function modPow($n, $x)
{
    if ($x === 0) return 1;
    $res = (modPow($n, $x >> 1) ** 2) % MOD;
    if ($x % 2 === 1) $res = modMul($res, $n);
    return $res;
}

// 階乗
function modFac($n)
{
    if ($n === 0) return 1;
    return modMul($n, modFac($n - 1));
}

// 順列
function nPr($n, $r)
{
    if ($r === 0) return 1;
    return modMul(nPr($n, $r - 1), $n - $r + 1);
}

// 組み合わせ
function nCr($n, $r)
{
    $r = min($r, $n - $r);
    if ($r === 0) return 1;
    return modDiv(nPr($n, $r), modFac($r));
}

// 階乗、逆元を前処理
function init($n)
{
    global $fact, $ifact;
    $fact[0] = 1;
    for ($i = 1; $i <= $n; ++$i) $fact[$i] = modMul($fact[$i - 1], $i);
    $ifact[$n] = modDiv(1, $fact[$n]);
    for ($i = $n; $i >= 1; --$i)
        $ifact[$i - 1] = modMul($ifact[$i], $i);
}

// 順列（前処理）
function nPr2($n, $r)
{
    global $fact, $ifact;
    return modMul($fact[$n], $ifact[$n - $r]);
}

// 組み合わせ（前処理）
function nCr2($n, $r)
{
    global $fact, $ifact;
    return modMul(modMul($fact[$n], $ifact[$r]), $ifact[$n - $r]);
}


Measured memory_bytes: 35408
#include <bits/stdc++.h>
    using namespace std;
	int main(){
      int A,B;
      cin >> A >> B;
      int answer = 0;
      
      for(int i = A; i < B+1; i++){
        string j = to_string(i);
        string p,q,r,s,t;
        p = j[0];
        q = j[1];
        r = j[2];
        s = j[3];
        t = j[4];
        if (p == t && q ==s) answer++;
        else continue;
      }
      cout << answer << endl;
    }

Measured memory_bytes: 3700
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
int cnt[50],n;
int main(){
    cin>>n;
    int a,xors=0;
    lol(i,n){
	cin>>a;
	xors^=a;
	int x=0;
	while(a%2==0)x++,a/=2;
	cnt[x]++;
    }
    int bef=xors%2,x=0,ans=0;
    while(1){
	if(bef!=xors%2){
	    //cout<<"#"<<x<<" "<<xors%2<<" "<<cnt[x]<<" "<<ans<<endl;
	    if(cnt[x-1]>0)ans++;
	    else ans=-mod;
	    bef=xors%2;
	}
	if(!xors)break;
	x++,xors/=2;
    }
    cout<<max(ans,-1)<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, C: "List[int]", S: "List[int]", F: "List[int]"):

    def hasha(curr, ith):
        if curr > S[ith]:
            return S[ith] + F[ith]*(-(-(curr-S[ith])//F[ith]))
        else:
            return S[ith]

    ans = []
    for i in range(N-1):        # 開始駅
        buf = 0
        for j in range(i, N-1):  # 現在駅
            buf = hasha(buf, j) + C[j]
        ans.append(buf)
    print(*ans, sep="\n")
    print("0")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [int()] * (N-1)  # type: "List[int]"
    S = [int()] * (N-1)  # type: "List[int]"
    F = [int()] * (N-1)  # type: "List[int]"
    for i in range(N-1):
        C[i] = int(next(tokens))
        S[i] = int(next(tokens))
        F[i] = int(next(tokens))
    solve(N, C, S, F)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import numpy as np
N, K = map(int, input().split())
lis = list(np.arange(1, N+1))
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(d):
        if A[j] in lis:
            lis.remove(A[j])
        else:
            continue
print(len(lis))

Measured memory_bytes: 27148
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>
#include <stack>
#include <bitset>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

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

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

  int a,b;
  string s;
  cin >> a >> b;

  if(a > b) {
    int tmp = b;
    b = a;
    a = tmp;
  }

  if((b-a)%2 == 0) {
    cout << (b+a)/2 << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  
  
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

fn main() {
    input!{
        a: usize,
        b: usize,
        c: usize
    }
    println!("{}", std::cmp::min(b / a, c));
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[5];
        int min = 1000;
        int mini = 0;
        for (int i = 0 ; i < 5 ; i++) {
                a[i] = sc.nextInt();
                if (min > a[i] % 10 && a[i] % 10 > 0) {
                    min = Math.min(min, a[i] % 10);
                    mini = i;
                }


        }

        if (mini == 1000) {
            mini = 0;
        }

        int sum = 0;
        for (int i = 0 ; i < 5 ; i++) {
            if (i != mini) {
                if (a[i] % 10 == 0) {
                    sum += a[i];
                } else {
                    sum += (a[i] / 10 +1 ) * 10;
                }
            }

        }
        sum += a[mini];
        System.out.println(sum);

    }

}

Measured memory_bytes: 21716
import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()
if N%2 == 1:
    print('No')
    exit()

n = (N//2)
j = True


for i in range(n):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')

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

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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n;
  cin >> n;
  if (n < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v% MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream& os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<mod>;

map< ll, int > prime_factor(ll n) {
    map< ll, int > ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

mint comb(ll k, ll n) {
    mint ans = 1;
    if (k - n < n)return comb(k, k - n);
    mint ansMul = 1, ansDiv = 1;
    rep(i, n) {
        ansMul *= (k - i);
        ansDiv *= (i + 1);
    }
    ans = ansMul / ansDiv;
    //ans = ansMul / ansDiv;
    return ans;
}

int main() {
	ll n, m;
    mint ans = 1;
	cin >> n >> m;
    map<ll, int>mp = prime_factor(m);
    for (auto p : mp) {
        ans *= comb(n + p.second - 1, p.second);
    }
    cout << ans<< endl;
	return 0;
}



Measured memory_bytes: 3600
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(ll i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
//nCr mod m
#define MOD 1000000007
#define M 4000010
vector<ll> fact;
bool h=false;
ll A,B;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 0;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
void f(ll n,ll r,ll m=MOD){
	if(n<0||r<0||n<r){
		A=0;
		return;
	}
	(A*=fact[n])%=MOD;
	(B*=fact[r]*fact[n-r]%MOD)%=MOD;
	return;
}
int main(){
	ll a,b,c,d,e;
	while(cin>>a>>b>>c>>d>>e,a+b+c+d+e){
		ll out=0;
		ll aa=nCr(a+b+c,a),bb=nCr(b+c,b);
		rep(s,d+1){
			A=B=1;
			ll t=e-d+s;
			if(t<0||t>e)continue;
			ll w=1;
			if(s||a){
				f(s-1,a-1);
				(A*=aa)%=MOD;
			}
			if(t||b){
				f(t-1,b-1);
				(A*=bb)%=MOD;
			}
			f(d-s+a+b+c-1,a+b+c-1);
			(out+=A*powmod(B,MOD-2,MOD))%=MOD;
		}
		cout<<out<<endl;
	}
}








Measured memory_bytes: 33920
n, m = map(int, input().split())
h = [int(i) for i in input().split()]
route = {i: [] for i in range(n)}
for _ in range(m):
    a, b = map(int, input().split())
    route[a - 1].append(b - 1)
    route[b - 1].append(a - 1)
good = 0
for key in route.keys():
    flag = 0
    if len(route[key]) == 0:
        good += 1
        continue
    for position in route[key]:
        height = h[key]
        if height <= h[position]:
            flag = 1
            break
    if flag == 0:
        good += 1
print(good)

Measured memory_bytes: 37792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int N = 1000 + 5;

int main()
{
	ll a,v,b,w,t,x;
	cin >> a >> v >> b >> w >> t;
	if(a > b)
		x = a - b;
	else
		x = b - a;
	if(v < w)
		cout << "NO" << endl;
	else{
		if((v-w)*t >= x)
			cout << "YES" << endl;	
		else
			cout << "NO" << endl;
	}
	return 0;
} 

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

int c;
string s;

int main()
{
    cin>>s;
    for(int i=0;i<s.length();i++)
        if(s[i]=='C')
            c = 1;
        else if(s[i]=='F' && c)
        {
            cout<<"Yes\n";
            exit(0);
        }
    cout<<"No\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;

int main()
{
	string str;

	getline(cin, str);

	for (unsigned int i = 0; i < str.size(); i++) {
		if (islower(str[i]))
			cout << (char)toupper(str[i]);
		else if (isupper(str[i]))
			cout << (char)tolower(str[i]);
		else
			cout << str[i];
	}
	cout << endl;

    return 0;
}

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

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

  priority_queue<int> Left;
  priority_queue<int, vector<int>, greater<int>> Right;
  int tmp;

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

    if (Left.size() <= Right.size()) {
      Left.push(tmp);
    } else {
      Right.push(tmp);
    }

    if (Left.empty() || Right.empty())
      continue;

    if (Left.top() > Right.top()) {
      tmp = Left.top();
      Left.pop();
      Left.push(Right.top());

      Right.pop();
      Right.push(tmp);
      continue;
    }
  }

  int ans;

  if (Left.size() != Right.size())
    ans = 0;
  else if (Left.top() == Right.top())
    ans = 0;
  else {
    ans = Right.top() - Left.top();
  }

  cout << ans << endl;

  return 0;
}


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

// int ± 3.27 × 10^4
typedef long long int ll;  // ± 9.22 × 10^18
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;

void solve(ll N, ll M, vi H, vi A, vi B){
    vector<bool> good(N, true);
    for (int i = 0; i < M; i++) {
        int a = A[i] - 1;
        int b = B[i] - 1;
        if (H[a] >= H[b]) good[b] = false;
        if (H[a] <= H[b]) good[a] = false;
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
        if (good[i]) ans++;

    cout << ans << endl;
}

int main(){
    ll N;
    scanf("%lld",&N);
    ll M;
    scanf("%lld",&M);
    vi H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    vi A(M);
    vi B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, M, std::move(H), std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 5568
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *XYH = map(int, read().split())

    for cx in range(101):
        for cy in range(101):
            ok = 10 ** 9 + 100
            ng = 0
            while ok - ng > 1:
                mid = (ok + ng) // 2
                valid = True
                for x, y, h in zip(*[iter(XYH)] * 3):
                    if max(mid - abs(x - cx) - abs(y - cy), 0) < h:
                        valid = False
                        break
                if valid:
                    ok = mid
                else:
                    ng = mid
            H = ok
            valid = True
            for x, y, h in zip(*[iter(XYH)] * 3):
                if max(H - abs(x - cx) - abs(y - cy), 0) != h:
                    valid = False
                    break
            if valid:
                print(cx, cy, H)
                return

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 74924
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    n,x = map(int, input().split())
    m = [int(input()) for _ in range(n)]
    print(n+(x-sum(m))//min(m))

if __name__ == '__main__':
    main()

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

int main(void) {
    int n, max;
    cin >> n;
    int ans = 1;
    cin >> max;
    for (int i = 1; i < n; ++i) {
        int h;
        cin >> h;
        if (h >= max) {
            max = h;
            ++ans;
        }
    }
    cout << ans << endl;
}


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

int main(){
  ll n;
  cin >> n;
  string ans;
  while(n){
    n--;
    ans +='a'+n%26;
    n/=26;
  }
  reverse(ans.begin(),ans.end());
  cout << ans << endl;
  return 0;
}
  


Measured memory_bytes: 3604
from sys import stdin
input = stdin.readline
N,T = map(int,input().split())
prices = list(map(int,input().split()))
last = 10000000000
highestTally = [prices[-1]]
highestCount = [1]

for price in prices[-2:-N-1:-1]:
    if price==highestTally[-1]:
        highestCount.append(highestCount[-1]+1)
    else:
        highestCount.append(1)
    highestTally.append(max(highestTally[-1],price))
highestTally.reverse()
highestCount.reverse()

indexOfHighest={}
for i in range(N-1,-1,-1):
    if highestTally[i]==prices[i]:
        indexOfHighest[highestTally[i]]=i

biggestJump=0
sellingPriceForBiggestJump=0
HPcount=0
LPcount=0
HPGroups=[]
LPGroups=[]
for index,price in enumerate(prices):
    if index==N-1:
        break
    bestSellingPrice = highestTally[index+1]
    jump = bestSellingPrice-price
    #print(jump,bestSellingPrice,biggestJump)
    if jump>biggestJump:
        biggestJump = jump
        #LPcount+=1
        LPGroups=[]
        HPGroups=[]
        
        LPGroups.append(1)
        sellingPriceForBiggestJump = bestSellingPrice
        #HPcount=highestCount[indexOfHighest[bestSellingPrice]]
        HPGroups.append(highestCount[indexOfHighest[bestSellingPrice]])
    elif jump==biggestJump:
        if bestSellingPrice!=sellingPriceForBiggestJump:
            sellingPriceForBiggestJump = bestSellingPrice
            #HPcount+=highestCount[indexOfHighest[bestSellingPrice]]
            HPGroups.append(highestCount[indexOfHighest[bestSellingPrice]])
            LPGroups.append(0)
        LPGroups[-1]+=1
count = 0
bs = T//2
for a,b in zip(HPGroups,LPGroups):
    if bs>min(a,b):
        count+=min(a,b)
    else:
        count+=bs
print(count)


Measured memory_bytes: 16696
#include<stdio.h>

int main()
{
    int t[4][3][10]={0};
    int b,f,r,v,i,j,k,n;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d%d%d",&b,&f,&r,&v);
        t[b-1][f-1][r-1]=t[b-1][f-1][r-1]+v;
        
        
        
    }
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" %d",t[i][j][k]);
            }
            printf("\n");
        }
        if(i!=3)printf("####################\n");
    }
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), s(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    s[0] = a[0];
    for (int i = 1; i < n; i++) {
        s[i] = min(s[i - 1] + a[i], a[n - 1]);
    }

    int r = 0;
    for (int i = 0;;) {
        int j = i;
        int t = s[i] * 2; // 吸収できる最大の大きさ
        auto it = upper_bound(a.begin(), a.end(), t); // 吸収できない最小の相手
        if (it == a.end()) break; // 吸収できない相手がいない
        i = (int)(it - a.begin()) - 1; // 吸収できる最大の相手 どんなに小さくても自分
        if (i == j) r = ++i;
    }
    cout << n - r << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
main(){
 int N;
 string S,answer;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> S;
    if(S=="Y"){
     answer="Four";
     break;
    }else{
      answer="Three";
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  xus <- replicateM n $ (\(a:b:_) -> (read a,b)) . words <$> getLine :: IO [(Double, String)]

  print $ solve xus

btcjpy = 380000

solve = foldr f 0 
  where
    f (x, u) acc = let ujpy = if u == "JPY" then 1 else btcjpy
                   in acc + x * ujpy

Measured memory_bytes: 636
# -*- coding: utf-8 -*-
# ABC 081 B - Shift Only
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b = [int(s) for s in input().split()]
i = -1 
j = True
while j:
    for k in range(a):
        if (b[k] % 2) == 0:
            b[k] = b[k] / 2
        else:
            j = False
            break
    i = i + 1
print(i)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end() //使うときはsort(all())という感じで
using ll = long long;

int main(){
  int N;
  cin>>N;
  cout<<N*N*N<<endl;
}

Measured memory_bytes: 256
Scanf.scanf "%d %d" (fun n s ->
    let rec f b n = if n < b then n else f b (n/b) + (n mod b) in

    let step3 n =
        if n = s then n + 1 else -1
    in

    let step2 n =
        let ns = n - s in
        let rec loop a =
            if a = 0 then step3 n else
                if ns mod a = 0 && s - a <= ns / a then ns / a + 1 else
                    loop (a - 1)
        in
        loop (min s (int_of_float (floor (sqrt (float ns) +. 0.5))))
    in

    let rec loop i =
        if i * i > n then step2 n else
            if f i n = s then i else
                loop (i + 1)
    in
    loop 2 |> Printf.printf "%d\n"
)

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x,mi,ans;
	cin>>x;
	mi=1000;
	for(int i=1;i<32;i++){
		if(i*i>x){
			break;
		}
		else if(x-i*i<mi){
			mi=x-i*i;
			ans=i*i;
		}
	}
	for(int i=0;i<11;i++){
		if(i*i*i>x){
			break;
		}
		else if(x-i*i*i<mi){
			mi=x-i*i*i;
			ans=i*i*i;
		}
	}
	for(int i=0;i<4;i++){
		if(i*i*i*i*i>x){
			break;
		}
		else if(x-i*i*i*i*i<mi){
			mi=x-i*i*i*i*i;
			ans=i*i*i*i*i;
		}
	}
	for(int i=0;i<3;i++){
		if(i*i*i*i*i*i*i>x){
			break;
		}
		else if(x-i*i*i*i*i*i*i<mi){
			mi=x-i*i*i*i*i*i*i;
			ans=i*i*i*i*i*i*i;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	char a, b;
	cin >> a >> b;
	if(a == b) cout << '=' << endl;
	else if(a > b) cout << '>' << endl;
	else cout << '<' << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

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

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

unsigned long long modpow(unsigned long long n, unsigned long long k, unsigned long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}
vector<vector<int>>adj(1e5+10);
vector<bool>vis(1e5+10,0);
stack<int>p;

void dfs(int v){
   if(vis[v]==1) return;
   vis[v] = 1;
   for(auto i:adj[v]) dfs(i);
   p.push(v);
}
void solve(){
     int n,m;
     cin >> n >> m;
     for(int i = 0;i<m;i++){
        int v,u;cin >> v >> u;
        adj[v].push_back(u);
     }
     for(int i = 1;i<=n;i++)
        dfs(i);
     vector<int>dp(n+1,0);
     while(!p.empty()){
        int v = p.top();p.pop();
        for(auto i:adj[v]){
           dp[i] = max(dp[i],dp[v]+1);
        }
     }
     int ans = 0;
     for(int i = 1;i<=n;i++){
        ans = max(ans,dp[i]);
     }
     cout << ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}

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

struct dice{
    int l[6];
    void roll(int a, int b){
        int t = l[0];
        l[0] = l[a];
        l[a] = l[5];
        l[5] = l[b];
        l[b] = t;}
    void dir(char a){
        if (a == 'N') roll(1, 4);
        if (a == 'S') roll(4, 1);
        if (a == 'E') roll(3, 2);
        if (a == 'W') roll(2, 3);}
};

int main(){
    dice d;
    REP(i, 6) cin >> d.l[i];
    string s;
    cin >> s;
    REP(i,s.size()) d.dir((char)s[i]);
    cout << d.l[0] << endl;
}

Measured memory_bytes: 3144
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
const int maxn = 1e6+7;

int main(){
	ll n,y;
	cin>>n>>y;
	for(ll a=0;a<=n;a++){
		for(ll b=0;b<=n;b++){
			if((a*10000+b*5000+(n-a-b)*1000==y)&&((n-a-b)>=0)){
				cout<<a<<" "<<b<<" "<<(n-a-b)<<endl;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1"<<endl;
	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
  
n,m = map(int, input().split())
abc = [list(map(int, input().split())) for i in range(m)]
INF = 10 ** 18
d = [[INF] * n for i in range(n)]
for i in range(n):
  d[i][i] = 0
road = defaultdict(int)
for a,b,c in abc:
  a -= 1
  b -= 1
  road[(a, b)] = 1
  d[a][b] = c
  d[b][a] = c

for k in range(n):
  for i in range(n):
    for j in range(n):
      if d[i][k] + d[k][j] < d[i][j]:
        d[i][j] = d[i][k] + d[k][j]
        road[(i,j)] = 0
        road[(j,i)] = 0
ans = m - sum(road.values())
print(ans)

Measured memory_bytes: 43884
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
const int INF = 1e16;
using Graph = vector<vector<int>>;

signed main(){
  int N, M;
  cin >> N >> M;

  Graph G(N);
  for( int i = 0; i < M; i++ ){
    int U, V;
    cin >> U >> V;
    U--; V--;
    G.at(U).push_back(V);
  }

  int S, T;
  cin >> S >> T;
  S--; T--;

  vector<vector<int>> dist(N, vector<int>(3, -1));
  queue<pair<int, int>> que;
  dist.at(S).at(0) = 0;
  que.push({S, 0});

  while( !que.empty() ){
    pair<int, int> P = que.front();
    int v = P.first;
    int time = P.second;
    que.pop();

    for( auto nv : G.at(v) ){
      int nt = (P.second+1)%3;
      if( dist.at(nv).at(nt) != -1 ) continue; //すでに通っていたらスルー
      dist.at(nv).at(nt) = dist.at(v).at(time)+1;
      que.push({nv, nt});
    }
  }

  if( dist.at(T).at(0) == -1 ) cout << -1 << endl;
  else cout << dist.at(T).at(0)/3 << endl;

 }


Measured memory_bytes: 11136
import java.util.*;
import java.lang.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s[] = new String[n];
        long m = 0;
        long a = 0;
        long r = 0;
        long c = 0;
        long h = 0;
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
            if (s[i].charAt(0) == 'M') {
                m++;
            } else if (s[i].charAt(0) == 'A') {
                a++;
            } else if (s[i].charAt(0) == 'R') {
                r++;
            } else if (s[i].charAt(0) == 'C') {
                c++;
            } else if (s[i].charAt(0) == 'H') {
                h++;
            }
        }
        System.out.println(m * a * (r + c + h) + m * r * (c + h) + m * c * h + a * r * (c + h) + a * c * h + r * c * h);
    }
}

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

int main() {
	int n; set<string> s; vector<string> s1; string s2; cin >> n;
	for(int i = 0; i < n; i++) { cin >> s2; s.insert(s2); s1.push_back(s2);}
	if(s.size() < n) cout << "No";
	else {
		int flag = 0;
		for(int i = 0; i < n - 1; i++) {
			if(s1[i][s1[i].size() - 1] != s1[i + 1][0]) {cout << "No"; flag = 1; break; }
		}
		if(flag == 0) cout << "Yes";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
//using namespace __gnu_pbds;
#define rep(i,a,b) for(i=(a);i<=(b);i++)
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define maxn 500005
#define inf 1e18
#define boost ios::sync_with_stdio(false);cin.tie(0)
#define fr freopen("source.txt","r",stdin),freopen("output.txt","w",stdout)
#define SET(a,b) memset(a,b,sizeof(a))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
//template<typename T>
//using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
ll f[maxn];
ll powermod(ll x,ll y){
	ll res=1;
	while(y>0){
		if(y&1)
		res=(res*x)%mod;

		y/=2;
		x=(x*x)%mod;
	}
	return res;
}
ll ncr(ll n,ll r){
    ll ans=f[n];
    ans=(ans*powermod(f[r],mod-2))%mod;
    ans=(ans*powermod(f[n-r],mod-2))%mod;
    return ans;
}
ll star_bar(ll n,ll k){
    return ncr(n+k-1,n);
}
int main()
{
    boost;
    ll n,i,j,x,t,y,k;
    cin>>n>>k;
    k=min(n-1,k);
    f[0]=f[1]=1;
    for(i=2;i<maxn;i++) f[i]=(f[i-1]*i)%mod;
    ll ans=0;
    for(i=0;i<=k;i++){
        ll temp=ncr(n,i);
        temp=(temp*star_bar(i,n-i))%mod;
        ans=(ans+temp)%mod;
    }
    cout<<ans;
}

Measured memory_bytes: 4224
import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		int N = 0;
		int v = 0;
		int i = 0;
		int j = 0;
		int A[];
		String str = "";
		
		N = Integer.parseInt(as.next());
		
		A = new int[N];
		
		for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		}
		System.out.println(sb.toString());
		
		sb.setLength(0);
		
		for(i=1;i<=N-1;i++){
			
			v = A[i];
			j = i - 1;
			while(j >= 0 && A[j] > v){
				
				A[j+1] = A[j];
				j--;
				
			}
			A[j+1] = v;
			
			for(int k=0;k<N;k++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			
		}

	}

}

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

int N;
vector<int> G[100001];
bool used[100001];
bool ans = true;
bool match[100001];

void  dfs(int v, int par) {
  used[v] = true;
  for(int i = 0; i < G[v].size(); i++) {
    if(used[G[v][i]])continue;	       		      	      
    dfs(G[v][i],v);
    
  }
  if(!match[v] && !match[par]) match[v] = match[par] = true;
  return;
}
    

int main() {
  cin >> N;

  

  for(int i = 0; i < N-1; i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  if(N % 2 == 1){ cout <<"First" <<endl; return 0; }
  dfs(0,-1);

  for(int i = 0; i < N; i++) {
    if(!match[i]) {ans = false; break;}
    }

  if(!ans) cout <<"First"<< endl;
  else cout << "Second" <<endl;
  
}


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

int main() {
	int N;
	cin >> N;
	map<int,int>mp;
	for (int i=0;i<N;i++) {
		int n;
		cin >> n;
		mp[n]++;
	}
	int ans = 0;
	for (auto p:mp) {
		if(1 == p.second%2) {
			ans++;
		}
	}
	cout << ans <<  endl;
	return 0;
}


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

int main()
{
	vector<int> v = {0, 1, 2, 3, 4};
	vector<int> a(5);
	for (int i = 0; i < 5; i++)
		cin >> a.at(i);
	int t = 0, ans = 10000;
	do
	{
		for (auto x : v)
		{
			while (t % 10 != 0)
			{
				t++;
			}
			t += a.at(x);
		}
		if (t < ans)
			ans = t;
		t = 0;
	} while (next_permutation(v.begin(), v.end()));
	cout << ans << endl;
}

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

int main()
{
 bool prime[1000000];

 prime[0]=prime[1]=false;
 for(int i=2;i<1000000;i++){
	prime[i]=true;
 }
 for(int i=2;i*i<1000000;i++){
	if(prime[i]){
		for(int j=i*i;j<1000000;j+=i){
			prime[j]=false;
		}
	}
 }

//???????????§?´???°??¨
 int n,x,pea;
 
 
 while(1){
	pea=0;
	cin>>n;
  if(n==0)break;
	for(int i=0;i<n/2+1;i++){
		if(prime[i]){
			x=n-i;
			if(prime[x]){
				pea++;
			}
		}
 	 }
 //	cout<<"??????????????????"<<pea<<"???????????????"<<endl;
	cout<<pea<<endl;
 }

 return 0;
}
	

Measured memory_bytes: 4056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,i,j,s=0;
    vector<int>v;
    cin>>a>>b;
    for(i=2;i<=a*2;i+=2)
    {
        v.push_back(i);
    }
    for(i=1;i<=b*2;i+=2)
    {
        v.push_back(i);
    }
    for(i=0;i<v.size();i++)
    {
        for(j=i+1;j<v.size();j++)
        {
        if((v[i]+v[j])%2==0)
            s++;
        }
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, S: str):
    S = S[:K-1] + S[K-1].lower() + S[K:]
    print(S)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, K, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
N,M=map(int,input().split())
inf=12*(10**5)+1

dp=[inf for j in range(2**N)]
dp[0]=0

for i in range(M):
    a,b=map(int,input().split())
    c=sum([1<<(i-1) for i in list(map(int,input().split()))])
#    print(a,b,c)
    for j in range(2**N):
        dp[j|c]=min(dp[j|c],dp[j]+a)
#    print(dp)

print(dp[2**N-1] if dp[2**N-1]!=inf else -1)

Measured memory_bytes: 3188
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<lint> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A.begin(), A.end());

	vector<pair<int, int>> ans;
	if (A.front() > 0) {
		ans.emplace_back(A.front(), A.back());
		A.front() -= A.back();
		A.pop_back();
		N--;
	}	
	if (A.back() < 0) {
		ans.emplace_back(A.back(), A.front());
		A.front() = A.back() - A.front();
		A.pop_back();
		sort(A.begin(), A.end());
		N--;
	}

	int cnt = N - 2;
	while (A[cnt] > 0 && cnt >= 0) {
		
		ans.emplace_back(A.front(), A[cnt]);
		A.front() -= A[cnt];
		cnt--;

	}
	while (cnt >= 0) {

		ans.emplace_back(A.back(), A[cnt]);
		A.back() -= A[cnt];
		cnt--;

	}

	cout << A.back() << "\n";
	for (const auto &e : ans) cout << e.first << " " << e.second << "\n";



	return 0;
}

Measured memory_bytes: 3572
import math

def coh(n, p1, p2, pt_list, m):
    if n>m:
        return 
    x1, y1 = p1
    x2, y2 = p2
    
    nx, ny = -(y2-y1), x2-x1

    xs, ys = x1 + (x2-x1)/3, y1 + (y2-y1)/3
    xu, yu = (x1+x2)/2 + nx*math.sqrt(3)/2/3 , (y1+y2)/2 + ny*math.sqrt(3)/2/3  
    xt, yt = x1 + (x2-x1)*2/3, y1 + (y2-y1)*2/3
    
    ps = xs, ys
    pu = xu, yu
    pt = xt, yt
    
    coh(n+1, p1, ps, pt_list, m)
    pt_list += [ps]
    coh(n+1, ps, pu, pt_list, m)
    pt_list += [pu]
    coh(n+1, pu, pt, pt_list, m)
    pt_list += [pt]
    coh(n+1, pt, p2, pt_list, m)

m = int(input())
pt_list = [(0,0)]
coh(1, (0,0), (100,0), pt_list, m)
pt_list += [(100,0)]
for xy in pt_list:
    print('%.9f %.9f'%(xy[0], xy[1]))


Measured memory_bytes: 6228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vb = vector<bool>;
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 LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main() {
	int n, h, in1, in2, ans = 0;
	vi a, b;
	cin >> n >> h;
	rep(i, n) {
		cin >> in1 >> in2;
		a.push_back(in1);
		b.push_back(in2);
	}
	int t = *max_element(all(a));
	sort(all(b), greater<int>());
	rep(i, n) {
		if (t < b[i]) {
			h -= b[i];
			ans += 1;
		}
		if (h <= 0)break;
	}
	if (h > 0)ans += ceil(double(h)/t);
	cout << ans << endl;
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll N, M, Q;

void dfs(ll &ans, vl &A, ll ind, vl a, vl b, vl c, vl d){
  if(ind == N + 1){
    ll score = 0;

    rep(i, Q){
      if(A[b[i]] - A[a[i]] == c[i]) score += d[i];
    }

    ans = max(ans, score);
    return;
  }

  rep2(i, A[ind - 1], M + 1){
    A[ind] = i;
    dfs(ans, A, ind + 1, a, b, c, d);
  }
}

int main(){
  cin >> N >> M >> Q;
  vl a(Q), b(Q), c(Q), d(Q);
  rep(i, Q) cin >> a[i] >> b[i] >> c[i] >> d[i];

  vl A(N + 1, 0);
  A[0] = 1;
  ll ans = -1;
  dfs(ans, A, 1, a, b, c, d);

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


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T> inline vector<T> readVector(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> void EXIT(T answer) { cout<<answer<<endl; exit(0); }
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef signed long long int ll;

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

    int a,b,c; cin>>a>>b>>c;
    if(a+b+c>=22) cout<<"bust"<<endl;
    else cout<<"win"<<endl;

    return 0;
}



Measured memory_bytes: 256