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

int main()
{
    int n, a[10005];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int min = 1000010, max = -1000010;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] < min) min = a[i];
        if (a[i] > max) max = a[i];
        sum += a[i];
    }

    cout << min << " " << max << " " << sum << endl;

    return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define sortV(v) v.begin(),v.end()
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
/*ncr mod m
const int mod=1000000009;
int c[r+1];
void ncr(int n,int r){c[0]=1;repre(i,1,n)for(int j=min(i,r);j>0;j--)c[j]=((c[j-1]%mod)+(c[j]%mod))%mod;return c[r];}*/
int32_t main()
{
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  fastio
  string s,t;
  cin>>s;
  cin>>t;
  map<char,vector<int> >mp;
  rep(i,s.size())mp[s[i]].pb(i);
  int ans=0;
  int prev=-1;
  int rep=0;
  rep(i,t.size())
  {
    char c=t[i];
    if(mp[c].size()==0)
    {
      ans=-1;
      break;
    }
    int itr=upper_bound(sortV(mp[c]),prev)-mp[c].begin();
  //  cout<<c<<" "<<itr<<endl;
    if(itr==mp[c].size())
    {
      rep++;
      ans=(rep*s.size())+(mp[c][0]+1);
  //    cout<<ans<<endl;
      prev=mp[c][0];
    }
    else
    {
      prev=mp[c][itr];
    }
  //  cout<<"prev "<<prev<<endl;
  }
//  cout<<rep<<endl;

  if(ans==-1){cout<<"-1\n";exit(0);}
  ans=rep*s.size()+prev+1;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1736
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 1e+5;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

void solve() {
    int m;
    cin >> m;
    cout << 48 - m << endl;
}

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


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
Int dp[90][360][360];
signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  Int T;
  cin>>T;
  while(T--){
    Int n;
    cin>>n;
    vector<Int> v(n);
    for(Int i=0;i<n;i++) cin>>v[i];
    if(n==1){
      cout<<v[0]<<endl;
      continue;
    }
    memset(dp,0,sizeof(dp));
    dp[1][v[0]][v[1]]=1;
    const Int W = 350;
    for(Int i=1;i<n-1;i++){
      for(Int j=0;j<W;j++){
	for(Int k=0;k<W;k++){
	  if(!dp[i][j][k]) continue;
	  dp[i+1][k][v[i+1]]=1;
	  if(k) dp[i+1][k-1][v[i+1]+j]=1;
	}
      }
    }

    Int ans=0;
    for(Int i=0;i<W;i++)
      for(Int j=0;j<W;j++)
	if(dp[n-1][i][j]) ans=max(ans,j);
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 94204
#include <stdio.h>
#include <string.h>
#include <math.h>

int main() {

    int n;
    scanf("%d", &n);

    if (n % 1000 == 0) {
        printf("0");
    } else {
        int num = n / 1000 + 1;
        printf("%d", num * 1000 - n);
    }


    return 0;
}


Measured memory_bytes: 1668
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値

using namespace std;

int main(void){
    int N; cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i]%2==1){
            A[i] = 0;
        }else{
            if(A[i]%3==0||A[i]%5==0){
                A[i] = 0;
            }
        }
    }
    for(int i=0;i<N;i++){
        if(A[i]!=0){
            cout << "DENIED" << endl;
            break;
        }
        if(i==N-1){
            cout << "APPROVED" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
def insertionSort(a):
    print(" ".join([str(i) for i in a]))
    n = len(a)
    for i in range(1, n):
        v = a[i]
        j = i-1
        while j>=0 and a[j]>v:
            a[j+1] = a[j]
            j-=1
        a[j+1] = v
        print(" ".join([str(i) for i in a]))
        
n = input()
a = [int(s) for s in input().split(" ")]
insertionSort(a)

Measured memory_bytes: 7676
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.IO;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main()
    {
        //var exStdIn = new System.IO.StreamReader("C:\\Users\\hmakita\\Downloads\\even_0.txt");
        //System.Console.SetIn(exStdIn);

        long n = long.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        long[] l = new long[2 * n + 2];
        List<long> forward = new List<long>();
        List<long> backward = new List<long>();
        int direction = 1;
        
        for(long i = 0; i < n; i++)
        {
            if(direction == 1)
            {
                forward.Add(a[i]);
            }
            else
            {
                backward.Add(a[i]);
            }
            direction *= -1;
        }

        if(direction == 1)
        {
            backward.Reverse();
            long size = backward.Count();
            long count = 1;

            foreach(var item in backward)
            {
                Console.Write(item);
                if(count++ != size)
                {
                        Console.Write(" ");
                }
            }
            size = forward.Count();
            count = 1;

            if(size > 0)
            {
                Console.Write(" ");
            }

            foreach (var item in forward)
            {
                Console.Write(item);
                if (count++ != size)
                {
                    Console.Write(" ");
                }
            }
            //Console.WriteLine(String.Join(" ", list.ToArray()));
        }
        else
        {

            forward.Reverse();
            long size = forward.Count();
            long count = 1;

            foreach (var item in forward)
            {
                Console.Write(item);
                if (count++ != size)
                {
                    Console.Write(" ");
                }
            }

            size = backward.Count();
            count = 1;

            if (size > 0)
            {
                Console.Write(" ");
            }

            foreach (var item in backward)
            {
                Console.Write(item);
                if (count++ != size)
                {
                    Console.Write(" ");
                }
            }

        }
    }
}

Measured memory_bytes: 41788
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N, M;
    cin >> N >> M;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
        cin >> a.at(i);
    int sum = 0;
    for (int i = 0; i < N; i++){
        sum += a.at(i);
    }
    sort(a.begin(),a.end(),greater<int>() );
    
    int tag = 0;
    int toku = sum /(4 * M);
    if (sum % (4 * M) == 0)
        toku --;
    for (int i = 0; i < M; i++){
        if (a.at(i) <= toku )
            break;
        if (i == M - 1)
            tag = 1;
    }
    
    if (tag == 1)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;
}


Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Println(resolve(parseProblem()))
}

func parseProblem() string {
	return scanString(sc)
}

func resolve(str string) int {
	blackNum := 0
	opNum := 0
	for i := 0; i < len(str); i++ {
		switch str[i] {
		case 'B':
			blackNum++
		case 'W':
			opNum += blackNum
		}
	}
	return opNum
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


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

int f[110][20];
int p[110][20];
int bit[30];
int sum[150];

void Bit(int n) {
	int i = 1;
	while (n > 0) {
		bit[i] = n % 2;
		n /= 2;
		i++;
	}
}

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

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= 10; j++) {
			cin >> f[i][j];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= 10; j++) {
			cin >> p[i][j];
		}
	}

	long long ans = 0, Max = -1e18;
	for (int i = 1; i <= 1023; i++) {
		for (int j = 1; j <= 15; j++) {
			bit[j] = 0;
		}
		Bit(i);

		for (int j = 1; j <= n; j++) {
			for (int k = 1; k <= 10; k++) {
				if (f[j][k] && bit[11 - k]) {
					sum[j]++;
				}
			}
		}

		for (int j = 1; j <= n; j++) {
			ans += p[j][sum[j]];
		}
		Max = max(Max, ans);
		ans = 0;
		for (int j = 1; j <= n + 10; j++) {
			sum[j] = 0;
		}
	}
	cout << Max << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,ll> pii;
const int max_N=1e5+10;
vector<int> fives;
vector <pii> G[max_N],rg[max_N];
bool isprime[55600];
void primecheck()
{
  for(int i=2;i<=55555;i++)
    {
      if(!isprime[i]) continue;
      vector<int> tmp;
      for(int j=1;j*j<=i;j++)
	{
	  if(i%j==0)
	    {
	      tmp.push_back(j);
	      tmp.push_back(i/j);
	    }
	}
      if(int(tmp.size())==2)
	{
	  //cout << i << endl;
	  isprime[i]=true;
	  if(i%5==1)fives.push_back(i);
	  for(int j=2*i;j<=55555;j+=i)
	    {
	      isprime[j]=false;
	    }
	}
    }
}


int main()
{
  int n;
  memset(isprime,true,sizeof(isprime));
  cin >> n;
  primecheck();
  for(int i=0;i<n;i++)
    {
      cout << fives[i] << endl;
    }
  return 0;
}


Measured memory_bytes: 4992
#include <vector>
#include <iostream>
#include <queue>
#include <bitset>

using namespace std;

#define INF 1<<30

typedef pair<int, int>Pa;
typedef pair<Pa, int>PP;
struct Edge{
  int to;
  int cost;
  int h;
  int r;
  Edge(int a, int b, int c, int d){
    to = a;
    cost = b;
    h = c;
    r = d;
  }
};

vector<Edge>G[128];
int N, M, H, K;
int S, T;
int P;
int dis[256][128][25];
int deals[256];
int bits[256];
int dp[256][256];


void dfs(int p, int bitmap){
  for(int i=0;i<256;i++) for(int j=0;j<256;j++) dp[i][j] = INF;
  dp[0][0] = 0;
  for(int i=0;i<(1<<K);i++){
    for(int j=0;j<P;j++){
      dp[j+1][i|bits[j]] = min(dp[j+1][i|bits[j]], dp[j][i] + deals[j]);
      dp[j+1][i] = min(dp[j+1][i], dp[j][i]);
      //      cout << j+1 << " " << static_cast<bitset<8> >(i|bits[j]) << " " << dp[j+1][i|bits[j]] << endl;
    }
  }
  //  for(int i=0;i<(1<<K);i++){
  //    cout << static_cast<bitset<8> >(i) << " " << dp[P][i] << endl;
  //  }
}

void dijkstra(int bitmap, int s){
  int (*dist)[25] = dis[bitmap];
  //  fill(dist, dist + 128*25, INF);
  for(int i=0;i<128;i++) for(int j=0;j<25;j++) dist[i][j] = INF;
  priority_queue<PP, vector<PP>, greater<PP> >PQ;
  PQ.push(PP(Pa(0, s), 0));
  dist[s][0] = 0;
  while(!PQ.empty()){
    PP q = PQ.top(); PQ.pop();
    int d = q.first.first;
    int p = q.first.second;
    int h = q.second;
    if(dist[p][h] < d) continue;
    //    cout << static_cast<bitset<8> >(bitmap) << " " << p << " " << d << endl;    
    for(int i=0;i<G[p].size();i++){
      Edge next = G[p][i];
      int cost = next.cost;
      if(bitmap & 1<<next.r) cost = 0;
      if(h+next.h <= H && dist[p][h] + cost < dist[next.to][h+next.h]){
	dist[next.to][h+next.h] = dist[p][h] + cost;
	PQ.push(PP(Pa(dist[next.to][h+next.h], next.to), h + next.h));
      }
    }
  }
}

int solve(){
  dfs(0, 0);
  
  for(int i=0;i<(1<<K);i++){
    dijkstra(i, S);    
  }

  int ret = INF;
  for(int i=0;i<(1<<K);i++){
    //    cout << static_cast<bitset<8> >(i) << " " << dp[P][i] << " " << dis[i][T] << endl;
    //    int d = INF;
    //    for(int j=0;j<=P;j++) d = min(d, dp[j][i]);
    //    if(d == INF || dis[i][T] == INF) continue;
    //    ret = min(ret, d + dis[i][T]);
    int dist = INF;
    for(int j=0;j<=H;j++) dist = min(dist, dis[i][T][j]);
    if(dp[P][i] == INF || dist == INF) continue;
    ret = min(ret, dp[P][i] + dist);
    //    if(dp[P][i] == INF || dis[i][T] == INF) continue;
    //    ret = min(ret, dp[P][i] + dis[i][T]);
  }
  if(ret == INF) return -1;
  return ret;
}

int main(){
  while(1){
    for(int i=0;i<128;i++) G[i].clear();
    cin >> N >> M >> H >> K;
    if(!(N || M || H || K)) break;
    for(int i=0;i<M;i++){
      int a, b, c, h, r;
      cin >> a >> b >> c >> h >> r; a--; b--; r--;
      G[a].push_back(Edge(b, c, h, r));
      G[b].push_back(Edge(a, c, h, r));
    }
    cin >> S >> T >> P; S--; T--;
    for(int i=0;i<P;i++){
      int l, d;
      cin >> l >> deals[i];
      int bit = 0;
      for(int j=0;j<l;j++){
	int k; cin >> k; k--;
	bit |= 1<<k;
      }
      bits[i] = bit;
    }

    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 6668
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

dp1 = []
dp2 = []

n = int(input())
a_list = list(map(int, input().split()))

for i in range(len(a_list)):
    if not dp1:
        dp1.append(a_list[0])
    else:
        dp1.append(gcd(dp1[-1], a_list[i]))
    if not dp2:
        dp2.append(a_list[-1])
    else:
        dp2.append(gcd(dp2[-1], a_list[-i-1]))

ret = 0

dp2.reverse()

for i in range(len(a_list)-2):
    val = gcd(dp1[i], dp2[-len(dp2)+2+i])
    ret = max(ret, val)

ret = max(ret, dp1[-2], dp2[1])

print(ret)

Measured memory_bytes: 68452
N, X, Y = map(int, input().split())


def f(i, j):
    v1 = j - i
    v2 = abs(X - i) + 1 + abs(j - Y)
    v3 = abs(Y - i) + 1 + abs(j - X)
    return min(v1, v2, v3)


D = [0] * N
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = f(i, j)
        D[d] += 1

for d in D[1:]:
    print(d)


Measured memory_bytes: 9312
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

void Main();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

void Main() {
  Cin(int, n);
  vector<int> v(n);
  iota(rng(v), 1);

  Cins(int, n, p);
  Cins(int, n, q);
  if (p == q) {
    cout << 0 << endl;
    return;
  }

  int cnt = 0;
  bool f = false;
  do {
    if (v == p || v == q) {
      if (f) break;
      f = true;
      cnt = 0;
    }
    cnt++;
  } while (next_permutation(rng(v)));

  cout << cnt << endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = ReadIntArray();
            int a = n[0];
            int b = n[1];

            if (13 <= a)
            {
                Console.WriteLine(b);
            }
            else if (6 <= a)
            {
                Console.WriteLine(b / 2);
            }
            else
            {
                Console.WriteLine(0);
            }
        }

//ここからテンプレート
        //1行に1入力
        private static string ReadString() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(ReadString()); }
        private static long ReadLong() { return long.Parse(ReadString()); }
        private static double ReadDouble() { return double.Parse(ReadString()); }
        //1行に複数入力(配列で取得)
        private static string[] ReadStringArray() { return ReadString().Split(new[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries); }
        private static int[] ReadIntArray() { return ReadStringArray().Select(int.Parse).ToArray(); }
        private static long[] ReadLongArray() { return ReadStringArray().Select(long.Parse).ToArray(); }
        private static double[] ReadDoubleArray() { return ReadStringArray().Select(double.Parse).ToArray(); }
    }
}


Measured memory_bytes: 13396
#include<iostream>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main(){
    string str;
    cin >> str;
    int q;
    cin >> q;
    F(i,0,q){
        string com;
        cin >> com;
        if(com=="print"){
            int a,b;
            cin >> a >> b;
            F(j,a,b+1){
                cout << str[j];
            }
            cout << endl;
        }
        else if(com=="reverse"){
            int a,b;
            cin >> a >> b;
            F(j,0,(b-a+1)/2){
                char t=str[a+j];
                str[a+j]=str[b-j];
                str[b-j]=t;
            }
        }
        else if(com=="replace"){
            int a,b;
            string p;
            cin >> a >> b >> p;
            F(j,0,b-a+1) str[a+j]=p[j];
        }
    }
    return 0;
}


Measured memory_bytes: 3224
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 1;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregio

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
  int n;
  cin >> n;
  int sum = 0;
  rep(i, n)
  {
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
//---------- Begin IO utilities ----------
// Thanks to https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:tt : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! p {
    ($v:ident) => {
        println!("{}", $v);
    };
    ($v:ident, $($t:ident),*) => {
        print!("{}", $v);
        ($(print!(" {}", $t)),*);
        println!();
    }
}
#[allow(unused_macros)]
macro_rules! ps {
    ($v:ident) => {
        println!("{}", $v.iter().collect::<String>());
    };
    ($v:ident, $($t:ident),*) => {
        print!("{}", $v.iter().collect::<String>());
        ($(print!(" {}", $t.iter().collect::<String>())),*);
        println!();
    }
}
#[allow(dead_code)]
fn pv<T: std::string::ToString>(v: &[T], sep: &str) {
    let s = v.iter().map(|e| e.to_string()).collect::<Vec<String>>().join(sep);
    println!("{}", s);
}
#[allow(dead_code)]
fn pvs(v: &[Vec<char>], sep:&str) {
    let s = v.iter().map(|e| e.iter().collect::<String>()).collect::<Vec<String>>().join(sep);
    println!("{}", s);
}
//---------- End IO utilities ----------

fn main() {
    input!{
        s: u8,
        w: u8,
    }
    if s <= w {
        println!("unsafe");
    } else {
        println!("safe");
    }
}


Measured memory_bytes: 2112
x, n = map(int, input().split())
p = list(map(int, input().split()))

check = 1000000
ans = 0

N = list(range(-300, 300))

for i in range(1, 101):
    if i in p:
        N.remove(i)

for i in range(len(N)):
    if check > abs(N[i]-x):
        check = abs(N[i]-x)
        ans = N[i]
print(ans)


Measured memory_bytes: 9192
A = input()
B = input()
C = input()
D = input()
E = input()
an = [A,B,C,D,E]
s = 0
an = list(map(int,an))
for i in an:
  s += i +(10-i%10 if i%10!=0 else 0)
ans = 10000
for i in range(5):
  ans = min(ans,s-(an[i]+(10-an[i]%10 if an[i]%10!=0 else 0))+an[i])
print(ans)
  


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

using namespace std;

int main(){
    int n; cin >> n;
    char s[n];
    for(int i = 0; i < n; i++) cin >> s[i];
    if(n%2 != 0){
        cout << "No" << endl;
    }else{
        for(int i = 0; i < n/2; i++){
            if(s[i] != s[i + n/2]){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }

}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
using namespace std;
 
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	int f;
	int g;
	if(a<b&&a<c){
		f=a;}else{
			if(b<a&&b<c){
				f=b;}else{
				f=c;}}
		if(d<e){
			g=d;}else{
			g=e;}
			cout<<f+g-50<<endl;


	return 0;}


Measured memory_bytes: 1164
#include<stdio.h>
#include<algorithm>
using namespace std;
struct Store {
	long long int cost;
	int count;
	bool operator < (const Store& b) const {
		return cost < b.cost;
	};
};
int main(void)
{
	long long int cost = 0;
	int N,M,no=0,i=0;//no=数,cost=合計価格
	Store a[100010];
	scanf("%d%d", &N,&M);
	for (int i= 0; i < N; i++) {
		scanf("%lld %d", &a[i].cost, &a[i].count);
	}
	sort(a, a + N);
	while (true) {
		if (no + a[i].count>=M) {
			cost += a[i].cost * (M - no);
			break;
		}
		no += a[i].count;
		cost += a[i].cost * a[i].count;
	i++;
	}
	printf("%lld", cost);
	return 0;
}

Measured memory_bytes: 1664
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

const int INF = 1e9;

int main() {
  int n, m, R;
  cin >> n >> m >> R;
  vector<int> lr;
  for (int i = 0; i < R; ++i) {
    int r;
    cin >> r; --r;
    lr.push_back(r);
  }

  vector<vector<int>> dist;
  for (int i = 0; i < n; ++i) {
    vector<int> ld(n, 0);
    for (int j = 0; j < n; ++j) {
      if (i == j) { continue; }
      ld[j] = INF;
    }
    dist.push_back(ld);
  }

  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    dist[a][b] = c;
    dist[b][a] = c;
  }

  for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
      }
    }
  }

  sort(lr.begin(),lr.end());
  int ans = INF;
  do {
    int d = 0;
    for (int i = 0; i < lr.size()-1; ++i) {
      d += dist[lr[i]][lr[i+1]];
      assert(d >= 0);
    }
    ans = min(ans, d);
  }
  while (std::next_permutation(lr.begin(), lr.end()));
  cout << ans << endl;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,d,c=0;
	cin>>n>>d;
	int a[n][d];
	for(int i=0;i<n;i++){
		for(int j=0;j<d;j++)
		cin>>a[i][j];
	}
	float sum=0.0;
	for(int i=0;i<n-1;i++){
		for(int p=i+1;p<n;p++){
		    for(int j=0;j<d;j++)
			sum+=pow((a[i][j]-a[p][j]),2);
			sum=sqrt(sum);
		    int s=sum;
		    if(sum-s==0)
		    c++;
		    sum=0.0;
		}
	}
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int r,c,q;
  while(cin>>r>>c>>q, r||c||q) {
    int a[q],b[q],o[q];
    REP(i, q) {
      cin>>a[i]>>b[i]>>o[i];
    }
    set<int> yoko;
    set<int> tate;
    long long num = 0;
    for (int i=q-1; i>=0; --i) {
      if (a[i] == 0) {
        if (o[i] == 1 && yoko.count(b[i]) == 0) 
          num += c - tate.size();
        yoko.insert(b[i]);
      } else {
        if (o[i] == 1 && tate.count(b[i]) == 0)
          num += r - yoko.size();
        tate.insert(b[i]);
      }
    }
    cout << num << endl;
  }
}

Measured memory_bytes: 2452
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int A, B; std::cin >> A >> B;
  if ( A == 1 ) A *= 100;
  if ( B == 1 ) B *= 100;
  if ( A > B ) std::cout << "Alice" << std::endl;
  else if ( A < B ) std::cout << "Bob" << std::endl;
  else std::cout << "Draw" << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(m);

  rep(i, m) { cin >> v.at(i); }
  rep(i, m) { n -= v.at(i); }

  if (n < 0) {
    cout << -1;
  } else {
    cout << n;
  }
  return 0;
}


Measured memory_bytes: 3672
/*----------------by syr----------------*/
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<limits>
#include<list>
#include<map>
#include<math.h>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<sstream>
#include<string>
#include<time.h>
#include<utility>
#include<vector>

using namespace std;

const int INF=1e9+7;
const int MOVE=705;

int n,m,ans=INF,cnt;
int vis[705];
int num[705][705];
int dp[705][1500];
bool con[705][705];
vector<int> ve[705];

void dfs(int cur,int cnt,bool col){
	if(vis[cur]!=-1){
		if(vis[cur]!=col){
			puts("-1");
			exit(0);
		}else return;
	}
	vis[cur]=col;
	num[col][cnt]++;
	for(int i=0;i<ve[cur].size();i++){
		dfs(ve[cur][i],cnt,col^1);
	}
	return;
}

int main(){
//	freopen("file.out","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		u--;v--;
		con[u][v]=con[v][u]=true;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(!con[i][j]&&i!=j){
				ve[i].push_back(j);
			}
		}
	}
	memset(vis,-1,sizeof(vis));
	for(int i=0;i<n;i++){
		if(vis[i]==-1) dfs(i,++cnt,0);
	}
/*	for(int i=1;i<=cnt;i++){
		printf("%d %d\n",num[0][i],num[1][i]);
	}
	puts("");
*/
	dp[0][0+MOVE]=1;
	for(int i=0;i<cnt;i++){
		for(int j=-700+MOVE;j<=700+MOVE;j++){
			if(!dp[i][j]) continue;
//			printf("%d %d %d\n",cnt,j+num[0][i+1]-num[1][i+1],j-num[0][i+1]+num[1][i+1]);
			dp[i+1][j+num[0][i+1]-num[1][i+1]]=true;
			dp[i+1][j+num[1][i+1]-num[0][i+1]]=true;
		}
	}
//	for(int i=-700+MOVE;i<=700+MOVE;i++) printf("%d ",dp[cnt][i]);
//	puts("");
	for(int i=-700+MOVE;i<=700+MOVE;i++){
		if(dp[cnt][i]){
			int a=(n+abs(i-MOVE))/2,b=(n-abs(i-MOVE))/2;
			ans=min(ans,a*(a-1)/2+b*(b-1)/2);
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 6400
#include<cstdio>
#include<algorithm>

using namespace std;
const int MAX_N = 100;

int N, K;
int X[MAX_N];

int main(){
  scanf("%d", &N);
  scanf("%d", &K);
  for(int i = 0; i < N; ++i){
    scanf("%d", &X[i]);
  }

  int ans = 0;
  for(int i = 0; i < N; ++i){
    int tmp = min(X[i], K - X[i]);
    ans += tmp;
  }
  printf("%d\n", ans * 2);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>


#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define scan(x) scanf("%lld",&x);
#define inf 5555555555555555555
#define mod 1000000007
#define pi 3.14159265358979323846
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef map<ll, ll> MAP;
typedef set<ll> SET;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[9] = { 1,-1,0,0,1,1,-1,-1,0 }, ddy[9] = { 0,0,1,-1,1,-1,1,-1,0 };
#pragma endregion
#define MAX 111111

ll a[MAX];
int main(void) {
  cin >> n;
  FOR(i, 1, n + 1) {
	scan(tmp);
	a[i] = tmp;
  }

  FOR(i, 1, n) {
	if (a[i] % 2 == 1 && a[i + 1] != 0) {
	  ans++;
	  a[i]--;
	  a[i + 1]--;
	}
  }

  FOR(i, 1, n + 1) {
	ans += a[i] / 2;
  }

  cout << ans << endl;

  return 0;
}

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

int main() {
	int n;
	cin >> n;
	int count = 0;
	int tmp;
	for(int i = 1; i <= n; i++) {
		tmp = 0;
		if(i % 2 == 1) {
			for(int j = 1; j <= i; j++) {
				if(i % j == 0) {
					tmp++;
				}
			}
			if(tmp == 8) {
				count++;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define REP(i, a) for (int i(0), _##i(a); i < _##i; ++i)
#define FOR(i, a, b) for (int i(a), _##i(b); i <= _##i; ++i)

#ifdef LOCAL
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, N, ...) N
#define _FE_1(_CALL, x) _CALL(x)
#define _FE_2(_CALL, x, ...) _CALL(x) _FE_1(_CALL, __VA_ARGS__)
#define _FE_3(_CALL, x, ...) _CALL(x) _FE_2(_CALL, __VA_ARGS__)
#define _FE_4(_CALL, x, ...) _CALL(x) _FE_3(_CALL, __VA_ARGS__)
#define _FE_5(_CALL, x, ...) _CALL(x) _FE_4(_CALL, __VA_ARGS__)
#define _FE_6(_CALL, x, ...) _CALL(x) _FE_5(_CALL, __VA_ARGS__)
#define FOR_EACH_MACRO(MACRO, ...)                                             \
  _NTH_ARG(__VA_ARGS__, _FE_6, _FE_5, _FE_4, _FE_3, _FE_2, _FE_1)              \
  (MACRO, __VA_ARGS__)
#define watch(x) cerr << "\033[1;32m" #x " = \033[1;34m" << (x) << "\033[0m; ";
#define debug(...)                                                             \
  cerr << "\033[2;31mLine " << __LINE__ << ": \033[0m";                        \
  FOR_EACH_MACRO(watch, __VA_ARGS__)                                           \
  cerr << endl
#else
#define debug(...)
#endif

using namespace std;

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '{' << p.first << ", " << p.second << '}';
}

template <class T, class = decltype(begin(declval<T>())),
          class = enable_if_t<!is_same<T, string>::value>>
ostream &operator<<(ostream &os, const T &c) {
  os << '[';
  for (auto it = begin(c); it != end(c); ++it)
    os << (it == begin(c) ? "" : ", ") << *it;
  return os << ']';
}
using ll = long long;

const int MOD = 1e9 + 7;

vector<int> nums;
int n, d;

const int N = 1e4;

int dp[N + 5][105][2];

int run(int i, int mod, int good) {
  if (i == n) {
    return mod == 0 ? 1 : 0;
  }
  int last = (good ? 9 : nums[i]);
  int &res = dp[i][mod][good];
  if (res != -1)
    return res;
  res = 0;
  FOR(x, 0, last) {
    res = (res + run(i + 1, (mod + x) % d, x < nums[i] || good)) % MOD;
  }
  return res;
}

void solve() {
  string s;
  cin >> s;
  nums.reserve(s.size());
  n = s.size();
  for (char c : s) {
    nums.EB(c - '0');
  }
  cin >> d;
  memset(dp, -1, sizeof dp);
  int ans = (run(0, 0, 0) - 1 + MOD) % MOD;
  cout << ans << "\n";
}

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

  int T = 1;
  // cin >> T;
  while (T--) {
    solve();
  }
}


Measured memory_bytes: 9344
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

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

    int n, m;
    ll p;
    cin >> n >> m >> p;
    int a, b;
    ll c;
    vector<tuple<int, int, ll>> edge;
    FOR(i, 0, m) {
        cin >> a >> b >> c;
        edge.push_back(make_tuple(--a, --b, c - p));
    }

    vector<ll> ans(n, -LLINF);
    ans[0] = 0;
    bool neg = false;
    eFOR(i, 1, n * 2) {
        for (auto next : edge) {
            tie(a, b, c) = next;
            if (chmax(ans[b], ans[a] + c)) {
                if (i > n && b == n - 1)neg = true;
            }
        }
    }

    cout << (neg ? -1 : max(ans[n - 1], 0LL)) << "\n";
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

vpll G[100005];
ll dist[100005];
bool visited[100005];

bool dfs(ll v){
  bool res=true;
  for(auto np: G[v]){
    ll nv=np.first, nc=np.second;
    if(visited[nv]){
      if(dist[nv]!=dist[v]+nc) return false;
    }else{
      visited[nv]=true;
      dist[nv]=dist[v]+nc;
      res&=dfs(nv);
    }
  }
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  rep(i,m){
    ll l,r,d; cin>>l>>r>>d;
    l--,r--;
    G[l].emplace_back(r,d);
    G[r].emplace_back(l,-d);
  }
  
  rep(i,n){
    if(visited[i]) continue;
    visited[i]=true;
    if(!dfs(i)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 16640
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const ll N=1e9,INF=~0u>>2;
ll n,ans,i,len,l,r,mid;
string rep;
int main(){
//	freopen("ex.in","r",stdin);
	cout<<"? 10000000000"<<endl;
	cin>>rep;
	if(rep=="Y"){
		ans=2;
		while(1){
			cout<<"? "<<ans<<endl;
			cin>>rep;
			if(rep=="Y"){
				cout<<"! "<<ans/2<<endl;
				return 0;
			}
			ans*=10;
		}
	}
	r=10;
	while(1){
		cout<<"? "<<r<<endl;
		cin>>rep;
		if(rep=="N") break;
		r*=10;
	}
	l=r/10;
	l--;r--;
	while(1<r-l){
		mid=(l+r)>>1;
		cout<<"? "<<mid<<"0"<<endl;
		cin>>rep;
		if(rep=="Y") r=mid;
		else l=mid;
	}
	cout<<"! "<<r<<endl;
	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int x,y,sum;
    scanf("%d%d",&x,&y);
    sum=(abs(abs(x)-abs(y))+1);
    if((x>0 && y>0) || (x<0 && y<0))
    {
        if(x<y)
        {
            printf("%d\n",y-x);
        }
        else
        {
            printf("%d\n",x-y+2);
        }
    }
    else if(x==0 || y==0)
    {
        if(x>0 && y==0)
        {
            printf("%d\n",x+1);
        }
        else if(x<0 && y==0)
        {
            printf("%d\n",-x);
        }
        else if(x==0 && y<0)
        {
            printf("%d\n",abs(y)+1);
        }
        else if(x==0 && y>0)
        {
            printf("%d\n",y);
        }
        else if(x==0 && y==0)
        {
            printf("0\n");
        }
    }
    else if((x>0 && y<0) || (x<0 && y>0))
    {
        printf("%d\n",sum);
    }
    else if(x==y)
    {
        if(x>0 && y>0)
        {
            printf("2\n");
        }
        else if(x<0 && y<0)
        {
            printf("0\n");
        }
    }
    return 0;
}


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

int main() {
  int A, B;
  bool f = false;
  cin >> A >> B;
  for (int i = 1; i <= 3; i++) {
    if ((A * B * i) % 2 == 1) {
      f = true;
      break;
    }
  }
  cout << (f?"Yes":"No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; i--)
#define rep2(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 pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==v.size()-1?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

ll comb[51][51];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,a,b;
    cin >> n >> a >> b;
    vl v(n);
    cin >> v;
    sort(rall(v));
    ll sum = 0;
    rep(i,a-1) sum += v[i];
    vector<LP> val;
    rep2(i,a,b+1) {
        sum += v[i-1];
        val.eb(sum,i);
    }
    sort(all(val),
            [](LP a,LP b){ return a.first*b.second > a.second*b.first; });
    cout << fixed << setprecision(10) << (double)val[0].first/val[0].second << endl;
    rep(i,51) rep(j,i+1) {
        if(j == 0) comb[i][j] = 1;
        else comb[i][j] = comb[i-1][j-1]+comb[i-1][j];
    }
    ll ans = 0;
    for(LP p : val) {
        if(val[0].first*p.second != val[0].second*p.first) break;
        int cnt = 0;
        rep(i,n) if(v[i] == v[p.second-1]) cnt++;
        int cntl = 0;
        rep(i,p.second) if(v[i] == v[p.second-1]) cntl++;
        ans += comb[cnt][cntl];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vi vector <int>
#define ll long long int
using namespace std;

int main()
{
    //Why u looking at my code lmao
    int N,X,t,i;
    vi xs;
    cin>>N>>X;
    for (i = 0;i < N; i++) { 
        cin>>t;
        xs.push_back(t);
    }
    xs.push_back(X);
    sort(xs.begin(),xs.end());
    vi diff;
    int ans = xs[1]-xs[0];
    for(i=2;i<=N;i++){
        ans = __gcd(ans, xs[i]-xs[i-1]);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 892
//BISMILLAH
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    
    
    int x;
    
    cin >> x;
    
    if(x>= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    
    
    
    
    
    return 0;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll N,X,nex,ans;
  vi L;
  cin >> N>> X;
  REP(i,N){
		int x;
		cin >> x;
		L.push_back(x);
	}
  ans = 1;
  nex = 0;
  REP(i,N){
    nex = nex+L[i];
    if(nex<=X){
      ans = ans+1;
    }
  }
  cout << ans<< endl;
  return 0;
}

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

int main() {
	int x,y,ax=4,ay=6;
	int a[7]={1,3,5,7,8,10,12};
	int b[4]={4,6,9,11};
	cin>>x>>y;
	for(int i=0;i<7;i++){
		if(a[i]==x){
			ax=1;
		}
		if(a[i]==y){
			ay=1;
		}
	}
	for(int i=0;i<4;i++){
		if(b[i]==x){
			ax=2;
		}
		if(b[i]==y){
			ay=2;
		}
	}
	if(x==2){
		ax=3;
	}
	if(y==2){
		ay=3;
	}
	if(ax==ay){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
import numpy as np
a,b,h,m = map(int,input().split())
time = h*60 + m
angle_a = 360*time/(12*60)
angle_b = 360*m/60
tmp = np.abs(angle_a - angle_b)
if tmp > 180:
    tmp = 360 - tmp
print(np.sqrt(a**2 + b**2 - 2*a*b*np.cos(tmp*np.pi/180)))

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	int n, k;cin >> n >> k;
	string str;cin >> str;
	REP(i, n){
		if(i + 1 == k)cout << (char)tolower(str[i]);
		else cout << str[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int length = a+b+1;
		String post = sc.next();
		char c = post.charAt(a);
		String start = post.substring(0,a);
		String end = post.substring(a+1,post.length());

		String ans = "";
		if(post.length() == length) {
			if(c == '-') {
				if(start.contains("-") || end.contains("-")) {
					ans = "No";
				}else {
				ans = "Yes";
				}
			}else {
				ans = "No";
			}
		}else {
			ans = "No";
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 21844
n=int(input())
a=list(map(int, input().split())) 
b=list(map(int, input().split())) 
countA=0
countA1=0
countB=0
countB1=0
v=[]
        
if sum(a)<sum(b):
    print(-1)
    exit()

for i in range(n):
    if a[i]>b[i]:
        v.append(a[i]-b[i])
    elif a[i]==b[i]:
        continue
    else:
        countA+=(b[i]-a[i])
        countA1+=1

if countA==0:
    print(0)
    exit()

v.sort()
v.reverse()

for i in range(len(v)):
    countB+=v[i]
    countB1+=1
    if countB>=countA:
        print(countA1+countB1)
        exit()



        
        
    
        

                
            
        
        
        

Measured memory_bytes: 18708