akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int n=fsc.nextInt();
        long ans=0;
        long[] c=new long[n];
        long mod=1_000_000_007;
        for(int i=0;i<n;i++){
            c[i]=fsc.nextLong();
        }
        Arrays.sort(c);
        if(n==1){
            System.out.println((c[0]*2)%mod);
            return;
        }
        for(int i=0;i<n;i++){
            ans+=c[i]*(n-i+1);
            ans%=mod;
        }
        fsc.close();
        ans*=pow2(2*n-2, mod);
        ans%=mod;
        System.out.println(ans);
    }
    static long pow2(long n, long mod){
        if(n==0) return 1;
        if(n==1) return 2;
        return (pow2(n/2, mod)*pow2(n-n/2, mod))%mod;
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 27172
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

ans :: Int -> Int -> Int -> Bool
ans k a b = a `div` k < b `div` k || a `mod` k == 0


main :: IO ()
main = do
	k <- readLn
	[a, b] <- readIntToList <$> BS.getLine
	if ans k a b
		then putStrLn "OK"
		else putStrLn "NG"


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    cout << ((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int main()
{
	int h;
	int n;

	scanf("%d %d", &h, &n);
	
	int sum = 0;

	for (int i = 0; i < n; i++)
	{
		int input;

		scanf("%d", &input);

		sum += input;
	}

	if (sum >= h)
	{
		printf("Yes\n");
	}

	else
	{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    int flag=1;
    for(int i=0;i<s.length();i++){
        if((i)%2==0){
            if(s.at(i)=='L'){
            flag=0;
            break;
            }
            
        }
        else{
            if(s.at(i)=='R'){
            flag=0;
            break;
            }
            
        }
    }
    if(flag==1){
    cout<<"Yes";
    }
    else{
    cout<<"No";
    }
    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  double a, b, x;
  cin >> a >> b >> x;
  double s = x / a;
  double rad;
  if (a * b / 2 <= s) {
    double h = (a * b - s) * 2 / a;
    rad = atan2(h, a);
  } else {
    double w = s * 2 / b;
    rad = atan2(b, w);
  }
  double deg = rad / (2 * M_PI) * 360;
  cout << fixed << setprecision(10) << deg << endl;
  return 0;
}

Measured memory_bytes: 4124
S = list(input())
set(S)
A = "abcdefghijklmnopqrstuvwxyz"
list(A)
count = 0
ans = "None"
an = -1
for i in range(len(A)):
    for j in range(len(S)):
        if A[i] == S[j]:
            count = 1
    else:
        if count == 1:
            count = 0
        elif count == 0:
            an = i
            break
if an != -1:
    print(A[an])
else:
    print("None")

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main () {
    int x;
    cin >> x;
    cout << lcm(x, 360) / x << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    int dp[100];
    dp[0] =dp[1]= 1;
    rep(i, n)
    {
        dp[i + 2] = dp[i + 1] + dp[i];
    }
    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 3096
import java.util.*;
import static java.lang.System.*;
public class Main {
    public static boolean oneFlg = true;
    public static void main(String[] args) throws Exception {
      Scanner sc = new Scanner(System.in);
      int btn1V = sc.nextInt();
      int btn2V = sc.nextInt();
      int sumM = 0;
      int max = comp(btn1V,btn2V);
      sumM = sumM + max;
      max--;
      if(!oneFlg){
          sumM = sumM + comp(max,btn2V);
      } else {
          sumM = sumM + comp(btn1V,max);
      }
      out.println(sumM);
        
    }
    //二つの値のうち、大きい値を求める。同じ値なら、v1を返す
    public static int comp(int v1,int v2){
        if(v1 <= v2){
            oneFlg = true;
            return v2;
        } else if(v1 > v2){
            oneFlg = false;
            return v1;
        }
        return -1;
    }
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	int A = 0, B = 0, C = 0; // 1,2,3の個数
	for(int i = 0; i < N; i++){
		int a; 
		cin >> a; 
		if(a == 1) A++; 
		else if(a == 2) B++; 
		else if(a == 3) C++;
	}
	double dp[310][310][310] = {}; 
	for(int s = 1; s <= N; s++){
		for(int c = 0; c <= s; c++){
			for(int b = 0; b <= s-c; b++){
                int a = s - b - c; 
                if(a + b + c > 0){dp[a][b][c] = (double) N / (a+b+c);} 
                double d = 0; 
				if(a > 0) {d += (double) a / (a+b+c) * dp[a-1][b][c];} 
				if(b > 0) {d += (double) b / (a+b+c) * dp[a+1][b-1][c];} 
				if(c > 0) {d += (double) c / (a+b+c) * dp[a][b+1][c-1];}
                dp[a][b][c] += d; 
			}
		}
	}
	cout.precision(20); 
	cout << dp[A][B][C] << endl;
}

Measured memory_bytes: 232960
#include<bits/stdc++.h>
using namespace std;
string s;
int ans=0;
int main()
{
	getline(cin,s);
    int chang=s.length();
    for(int i=0;i<chang;i++){
    	if(s[i]=='2') ans++;
	}
	cout<<ans;
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        var inputs = Console.ReadLine().Split(' ');
        var W = new int[N];
        var sum = 0;
        for (int i = 0; i < N; i++)
        {
            W[i] = int.Parse(inputs[i]);
            sum += W[i];
        }

        var tArea = 0;
        var notTArea = sum;
        var min = int.MaxValue;
        for (int t = 0; t < N; t++)
        {
            notTArea -= W[t];
            tArea += W[t];
            min = Math.Min(min, Math.Abs(notTArea - tArea));
        }

        Console.WriteLine(min);
    }
}



Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>

using namespace std;
int main(void){
    string s;
    cin >> s;
    if(s[0] ==s[1] &&s[1] !=s[2] &&s[2] ==s[3]) cout << "Yes" << endl; 
    else if(s[0] ==s[2] &&s[2] !=s[1] &&s[1] ==s[3]) cout << "Yes" << endl;
    else if(s[0] ==s[3] &&s[3] !=s[1] &&s[1] ==s[2]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char a;
    scanf("%c",&a);
    if(a>=65&&a<=90)
    {
      printf("A");
    }
      else if(a>=97&&a<=122)
    {
        printf("a");
    }

    return 0;
}


Measured memory_bytes: 1592
X, Y = map(int,input().split())
total=0
if X==1:
    total += 300000
elif X==2:
    total += 200000
elif X==3:
    total += 100000
if Y==1:
    total += 300000
elif Y==2:
    total += 200000
elif Y==3:
    total += 100000
if X==1 and Y==1:
    total += 400000
print(total)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<vector<int> > mat(n, vector<int>(n));
  for (int i = 0; i < n; ++i) {
    int u, k;
    cin >> u >> k;
    u--;
    for (int j = 0; j < k; ++j) {
      int v;
      cin >> v;
      v--;
      mat[u][v] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << mat[i][j] << (j == n - 1 ? "" : " ");
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 3164
/*************************************************************************
    > File Name: c.cpp
# File Name: c.cpp
# Author : xiaobuxie
# QQ : 760427180
# Email:760427180@qq.com
# Created Time: 2019年09月01日 星期日 20时17分33秒
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<map>
#include<cmath>
#include<cstring>
#include<set>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f
#define pq priority_queue<int,vector<int>,greater<int> >
ll gcd(ll a,ll b){
    if(a<b) return gcd(b,a);
    return b==0?a:gcd(b,a%b);
}
const int N=1e5+9;
int dp[N];
int a[N];
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    int now=1;
    int ans=0;
    while(now<b){
        ++ans;
        now+=a-1;
    }
    cout<<ans<<endl;

    return 0;
}

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
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;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) (x).erase(unique(all(x)), (x).end())
#define int long long

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    int n, m;
    cin >> n;
    vector<int> v(n);
    rep(i, n)
    {
        cin >> v[i];
    }
    cin >> m;
    rep(i, m)
    {
        int p, x, sum = 0;
        cin >> p >> x;
        rep(j, v.size())
        {
            if (p == j + 1)
            {
                sum += x;
            }
            else
            {
                sum += v[j];
            }
        }
        cout << sum << endl;
    }
    return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int N=in(),A=in(),B=in();
	string S=in<string>();
	vector<int> L(A,0),R(A,0);
	int lx=0,rx=0;
	REP(i,N){
		if(S[i]=='o'){
			if(!lx){
				L[lx]=i;
				lx++;
			}
			else if(lx<A && i-L[lx-1]>B){
				L[lx]=i;
				lx++;
			}
		}
		if(S[N-1-i]=='o'){
			if(!rx){
				R[rx]=N-1-i;
				rx++;
			}
			else if(rx<A && R[rx-1]-(N-1-i)>B){
				R[rx]=N-1-i;
				rx++;
			}
		}
	}
	reverse(ALL(R));
	REP(i,A){
		if(L[i]==R[i]){
			out(L[i]+1);
		}
	}
	return 0;
}


Measured memory_bytes: 3348
#include <iostream>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

namespace _{struct _{_(){ // initialize
  cin.tie(0); ios::sync_with_stdio(false);
}}_;}
template <typename T, size_t size>
inline size_t len(const T (&)[size]) { return size; }
#define println(s) cout << s << '\n';
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()

#define MAX_N 1001

int N, M;
int field[MAX_N];

int main() {
  while (true) {
    cin >> N >> M;

    // exit
    if (N == 0 && M == 0) break;
    rep(i, N) {
      cin >> field[i];
    }

    // simulation
    int pos = 0; // player position
    int answer = -1;

    bool exit_flag = false;
    rep(i, M) {
      // ????????????????????????
      //cout << "###################"<< endl;
      //cout << "position:   " << pos << endl;
      int rand; cin >> rand;
      // continue (without simulation)
      if (exit_flag == true) continue;
      //cout << "random:     " << rand << endl;

      pos += rand;
      //cout << "field[pos]: " << field[pos] << endl;
      
      if (pos >= N-1) {
        answer = i+1;
        exit_flag = true;
      }
      // !
      pos += field[pos];

      if (pos >= N-1) {
        answer = i+1;
        exit_flag = true;
      }
    }
    cout << answer << endl;
  }
  return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>

using namespace std;
char s[12];

int main() {

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

	int cnt1 = 0;
	int cnt2 = 0;
	int cnt3 = 0;

	for (int k = 0; k < a; ++k) {
		if (s[k] >= '0' && s[k] <= '9') {
			cnt1++;
		}
	}

	if (s[a] == '-') {
		cnt2++;
	}

	for (int k = a + 1; k <= a + b; ++k) {
		if (s[k] >= '0' && s[k] <= '9') {
			cnt3++;
		}
	}

	if (cnt1 == a && cnt2 == 1 && cnt3 == b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}

int main(){
  string a, b;
  cin >> a >> b;
  string s = a+b;
  int n = stoi(s);
  bool ans = false;
  REP(i,400){
    if(i*i == n) ans = true;
  }
  if(ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 256
n = int(input())
a = [input().split() for i in range(n)]

for i in range(4, -1, -1):
  if i==4 or i==2:
    a.sort(key=lambda x:x[i])
  else:
    a.sort(key=lambda x:int(x[i]))
for ele in a:
  print(" ".join(map(str, ele)))


Measured memory_bytes: 52240
N = int(input())
XY = [list(map(int,input().split())) for _ in range(N)]

PQ = []
for i in range(1,N):
    for j in range(i):
        x1,y1 = XY[i]
        x2,y2 = XY[j]
        P = x2-x1
        Q = y2-y1
        if P<0:
            P *= -1
            Q *= -1
        elif P==0 and Q<0:
            Q *= -1
        if not([P,Q] in PQ):
            PQ.append([P,Q])

if N <= 2:
    print(1)
else:
    ans = 50

    for p,q in PQ:
        ans_tmp = 0
        for x,y in XY:
            if not([x-p,y-q] in XY):
                ans_tmp += 1
        ans = min(ans,ans_tmp)
    print(ans)

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

int main()
{
	string s,t;
	cin>>s>>t;
	
	int n = s.size();
	int m = t.size();
	int cmax = 0;
	int l = n-m;
	for(int i=0;i<=l;i++)
	{
		int c=0;
		for(int j=i;j<(i+m);j++)
		{
			if(s[j]==t[j-i])
			c++;
		}
		cmax = max(c,cmax);
	}
	cmax = m-cmax;
	cout<<cmax;
}

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

#define MAX_W (1000)
#define MAX_N (1000)

int W, N;
int v[MAX_N], w[MAX_N];
int dp[MAX_N + 1][MAX_W + 1];

int rec_dp(int i, int wei)
{
  if (dp[i][wei] != -1){
    return (dp[i][wei]);
  }

  int res;
  if (i == N){
    res = 0;
  }
  else if (wei < w[i]){
    res = rec_dp(i + 1, wei);
  }
  else {
    res = max(rec_dp(i + 1, wei), rec_dp(i + 1, wei - w[i]) + v[i]);
  }

  return (dp[i][wei] = res);
}
int main()
{
  int cnt = 0;

  while (scanf("%d", &W), W){
    memset(dp, -1, sizeof(dp));
    scanf("%d", &N);
    for (int i = 0; i < N; i++) scanf("%d,%d", &v[i], &w[i]);
    for (int i = 0;;i++){
      if (rec_dp(0, i) == rec_dp(0, W)){
        printf("Case %d:\n", ++cnt);
        printf("%d\n%d\n", rec_dp(0, i), i);
        break;
      }
    }
  }

  return (0);
}

Measured memory_bytes: 5160
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

class union_find {
    private:
        vector<int> par;
        vector<int> ran;
        vector<ll> size;
    public:
        union_find(int n);
        int find(int x);
        void unite(int x, int y);
        bool same(int x, int y);
        ll show_size(int x);
};

union_find::union_find(int n){
    par.resize(n);
    ran.resize(n);
    size.resize(n);
    rep(i,n) par[i] = i;
    rep(i,n) ran[i] = 0;
    rep(i,n) size[i] = 1;
};

int union_find::find(int x) {
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    ll t = show_size(x)+show_size(y);
    size[x] = size[y] = t;
    if(ran[x] < ran[y]){
        par[x] = y;
        //size[y] += size[x];
    }
    else{
        par[y] = x;
        //size[x] += size[y];
        if(ran[x] == ran[y]) ran[x]++;
    }
};

ll union_find::show_size(int x) {
    if(par[x] == x) return size[x];
    return show_size(par[x] = find(par[x]));
}

bool union_find::same(int x, int y) {
    return (find(x) == find(y));
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	union_find uf(n);
	rep(i,m){
		int x, y;
		cin >> x >> y;
		uf.unite(x, y);
	}
	vector<bool> used(n, false);
	vector<int> idx(n);
	rep(i,n) idx[i] = i;
	int treeCount = 0;
	rep(i,n) treeCount += (i == uf.find(i));
	if(treeCount == 1){
		cout << 0 << endl;
		return 0;
	}
	sort(idx.begin(), idx.end(), [&](const int &i1, const int &i2){return a[i1] < a[i2];});
	ll ans = 0, cnt = treeCount - 2, total = 2 * (treeCount - 1);
	for(int i : idx){
		if(used[uf.find(i)]){
			if(cnt > 0){
				--cnt;
				--total;
				ans += a[i];
			}
		}
		else{
			used[uf.find(i)] = true;
			--total;
			ans += a[i];
		}
	}
	if(total == 0) cout << ans << endl;
	else cout << "Impossible" << endl;
    return 0;
}

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

constexpr int mod = 1e9 + 7;

int64_t power(int n, int k) {
    if(k == 0) return 1;
    else if(k == 1) return n;
    else if(k % 2 == 0) {
        int64_t p = power(n, k / 2) % mod;
        return p * p % mod;
    } else {
        int64_t p = power(n, k / 2) % mod;
        return p * p % mod * n % mod;
    }
}

int main() {
    int x, y;
    cin >> x >> y;

    if((x + y) % 3 != 0 || (2 * y - x) % 3 != 0) {
        cout << "0" << endl;
    } else {
        int n = (x + y) / 3;
        int k = (2 * y - x) / 3;
        if(n < k || n < 0 || k < 0) {
            cout << "0" << endl;
        } else {
            int64_t fact_n = 1;
            for(int i = 2; i <= n; i++) {
                fact_n *= i;
                fact_n %= mod;
            }
            int64_t fact_k = 1;
            for(int i = 2; i <= k; i++) {
                fact_k *= i;
                fact_k %= mod;
            }
            int64_t inv_fact_k = power(fact_k, mod - 2);
            int64_t fact_nk = 1;
            for(int i = 2; i <= n - k; i++) {
                fact_nk *= i;
                fact_nk %= mod;
            }
            int64_t inv_fact_nk = power(fact_nk, mod - 2);
            // cout << fact_n << " " << inv_fact_k << " " << inv_fact_nk << endl;
            cout << fact_n * inv_fact_nk % mod * inv_fact_k % mod << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);


int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  double ans = 0.0;
  rep(i,n){
    if(i == 0) ans = (double)(v[0] + v[1]) / (double)(2);
    else if(i == 1) continue;
    else ans = (double)(v[i] + ans) / (double)(2);
  }
  cout << setprecision(10) << ans << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}



Measured memory_bytes: 256
k, n = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n):
    a.append(a[i]+k)

maxi = 0
for i in range(2*n-1):
    maxi = max(maxi, a[i+1]-a[i])

print(k-maxi)


Measured memory_bytes: 92492
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Double x;
		String u;
		Double sum = 0.0;
		for(int i = 0;i < n;i ++) {
			x = sc.nextDouble();
			u = sc.next();
			if(u.equals("JPY")) sum += x;/*JPY.add(x);*/ 
			else sum += x * 380000; //BTC.add(x);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 23252
/*author  ADITYA BANSAL
         //~ MNNIT ALLAHABAD     */
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long
ll power(ll,ll);
ll ncr(ll,ll);
void fact();
ll mul(ll a,ll b);
#define watch(x) cerr<<(#x)<<"is"<<x<<nl;
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi(a,b) for(ll i=a; i<b; i++)
#define fk(a,b) for(ll k=a; k<b; k++)
#define fri(a,b) for(ll i=a; i>b; i--)
#define fj(a,b) for(ll j=a; j<b; j++)
#define ffi(a,b) for(ll i=a;i*i<=b;i++)
#define mp make_pair
#define ff first 
#define  tc ll t; cin>>t; while(t--)
#define all(v) (v).begin(),(v).end()
#define ss second
#define pb push_back
#define mem(v) memset((v),0,sizeof(v));
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define sll set<ll>
#define vll vector<ll>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define ad(a,b)  (a%mod+b%mod+mod)%mod
#define pob pop_back
#define nl endl
const int mod=1e9+7;
const ll  N=100002LL;
ll fac[N+2];
ll inv[N+2];

signed main(){ fast
   //~ tc
	
	{
		ll n,k;
		cin>>n>>k;
		ll a[n+1];
		fi(1,n+1) cin>>a[i];
		sort(a+1,a+n+1);
		ll dp[N+2];
		dp[0]=2;
		fi(1,k+1) {
			 ll f=0;
			fj(1,n+1) {    if(i-a[j]<0){ dp[i]=2; break; }   
				
				else if (dp[i-a[j]]==2)
				 { dp[i]=1; f=1;		
				     break;}
				 
			}
			if(!f) dp[i]=2;		
		}
		
	//~ fi(1,k+1) cerr<<dp[i]<<" ";	
		
		if(dp[k]==1) cout<<"First";
		else cout<<"Second";
		
		
	}
    return 0;
}
 
 
/******************************************************************************/
 
ll mul(ll a,ll b){
    return ((a)*(b))%mod;
}
 
ll power(ll a,ll n){
  ll res=1;
  while(n){
      if(n&1) res= mul(res,a);
     n>>=1; 
     a= mul(a,a);
  }
    return res;
}
void fact(){
	inv[0]=fac[0]=1;
	fi(1,N){
	 fac[i]=mul(fac[i-1],i);
	inv[i]=power(fac[i],mod-2);
}
}
 
ll ncr(ll r,ll n){
	
	if(r>n) return 0;
	ll e=fac[n];
	e=mul(e,inv[r]);
	e=mul(e,inv[n-r]);
	return e;
}


Measured memory_bytes: 1024
import java.util.Scanner;
     
    public class Main { //クラス名はMain
        public static void main(String[] args) {
            //コード
          Scanner sc = new Scanner(System.in);
          String n1 = sc.nextLine();
          String[] strArray1 = n1.split(" ");
          String word = sc.nextLine();
          String[] strArray2 = word.split(" ");
          //値の代入
          int seigen = Integer.parseInt(strArray1[1]);
          int count = 0;
          for(int i=0;i<Integer.parseInt(strArray1[0]);i++) {
            if (Integer.parseInt(strArray2[i]) >=  seigen){
       			count++;
      			}
      		else{
        		// 処理なし
      			}
          }
          System.out.println(count);
    }
    }

Measured memory_bytes: 34300
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	char A;
	map<char, char> al;

	al.insert(make_pair('A', 'T'));
	al.insert(make_pair('T', 'A'));
	al.insert(make_pair('C', 'G'));
	al.insert(make_pair('G', 'C'));

	cin >> A;
	cout << al[A] << endl;

	return 0;
}


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

using namespace std;
typedef long long ll;

int main(){
    int n, m; cin >> n >> m;
    vector< pair <int , int> > ga(n);
    vector< pair <int , int> > check(m);
    for(int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        ga[i].first = a;
        ga[i].second = b;   
    }
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        check[i].first = a;
        check[i].second = b;   
    }
    for(int i = 0; i < n; i++){
        int ans = 1001001001;
        int out;
        for(int j = 0; j < m; j++){
            int dist;
            dist = abs((ga[i].first - check[j].first)) + abs((ga[i].second - check[j].second));
//            cout << "dist" << dist << endl;
            if(dist < ans){
                ans = dist;
                out = j;
            }
        }
        cout << out + 1 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define TRAV(a, x) for(const auto& a : x)
#define ALL(x) x.begin(), x.end()
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

typedef long long ll;

ll n;
string in;
map<string, int> m;

void solve() {
  int max_occurs = 0;
  TRAV(a, m) {
    int v = a.second;
    if (v > max_occurs) max_occurs = v;
  }

  TRAV(a, m) {
    if (a.second == max_occurs) cout << a.first << endl;
  }
}

void input() {
  cin >> n;
  REP(i, n) cin >> in, m[in] += 1;
}
 
int main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 25216
#include <stdio.h>
int main(void){
    int n,x,g=0,i,l[100];
    
    scanf("%d%d",&n,&x);
    for(i=0;i<n;i++)scanf("%d",&l[i]);
    for(i=0;i<n;i++){
        g+=l[i];
        if(g>x)break;
    }
    printf("%d",i+1);
    
  return 0;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define bug cout << "bug" << endl
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

const ll N = 1e3 + 5, M = 1e4 + 5, INF = 1e9;

int main(){
	int x;
	cin >> x;
	if(x >= 400 && x <= 599){
		cout << 8 << endl;
		return 0;
	}
	if(x >= 600 && x <= 799){
		cout << 7 << endl;
		return 0;
	}
	if(x >= 800 && x <= 999){
		cout << 6 << endl;
		return 0;
	}
	if(x >= 1000 && x <= 1199){
		cout << 5 << endl;
		return 0;
	}
	if(x >= 1200 && x <= 1399){
		cout << 4 << endl;
		return 0;
	}
	if(x >= 1400 && x <= 1599){
		cout << 3 << endl;
		return 0;
	}
	if(x >= 1600 && x <= 1799){
		cout << 2 << endl;
		return 0;
	}
	if(x >= 1800 && x <= 1999){
		cout << 1 << endl;
	}
}

Measured memory_bytes: 3632
#include <string>
#include <cstdio>
#include <iostream>
using namespace std;
int main(){
  string c1,c2,u;
  int a1,a2;
  cin >> c1 >> c2;
  cin >> a1 >> a2;
  cin >> u;
  if(u==c1)
    cout << (a1-1) << " "<<a2;
  if(u==c2)
    cout << a1 << " "<<(a2-1);
  return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A= (map(int,input().split()))

Ns = sorted(A)
#print(Ns)

answer = Ns[len(Ns)-M]

sum = 0
for i in range(len(Ns)):
	sum = sum + Ns[i]
#print(sum)

if sum / (4 * M) <= answer:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

int main(){
  int N; cin >> N;
  vector<ll> A(N); rep(i,N) cin >> A[i];
  ll ans = 0;
  if(N%2==0){
    vector<ll> dp00(N+1, 0), dp01(N+1, 0), dp10(N+1, 0), dp11(N+1, 0);
    rep(i,N){
      dp00[i+1] = i%2? dp01[i] : -1e17;
      dp01[i+1] = dp00[i]+A[i];
      dp10[i+1] = max(dp00[i], dp11[i]);
      dp11[i+1] = dp10[i]+A[i];
    }
    /*
    rep(i,N+1) cout << dp00[i] << " ";
    cout << endl;
    rep(i,N+1) cout << dp01[i] << " ";
    cout << endl;
    rep(i,N+1) cout << dp10[i] << " ";
    cout << endl;
    rep(i,N+1) cout << dp11[i] << " ";
    cout << endl;
    */
    ans = max(dp10[N], dp11[N]);
  }
  else{
    vector<ll> dp00(N+1, 0), dp01(N+1, 0), dp10(N+1, 0), dp11(N+1, 0), dp20(N+1, 0), dp21(N+1, 0);
    rep(i,N){
      dp00[i+1] = i%2? dp01[i] : -1e17;
      dp01[i+1] = dp00[i] + A[i];
      dp10[i+1] = max(dp00[i], dp11[i]);
      dp11[i+1] = dp10[i]+A[i];
      dp20[i+1] = max(dp10[i], dp21[i]);
      dp21[i+1] = dp20[i]+A[i];
    }
    ans = max({dp20[N], dp21[N]});
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  while (1) {
    c -= b;
    if (c <= 0) {
      cout << "Yes";
      break;
    }
    a -= d;
    if (a <= 0) {
      cout << "No";
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <climits>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define srep(i, begin, end) for (__typeof(end) i = begin; i != end; i++)
#define si(x) int x = scanInt();
#define sll(x) LL x = scanLong();
#define sci(x) int x; scanf("%d", &x);
#define scll(x) LL x; scanf("%lld", &x);
#define pi(x) printf("%d ", x)
#define pll(x) printf("%lld ", x)
#define nl printf("\n")
#define clr(a) memset(a, 0, sizeof(a))
#define PB push_back
#define MP make_pair
using namespace std;
typedef unsigned int UI; // 32 bit integer
typedef long int LI; // 32 bit integer
typedef unsigned long int ULI; // 32 bit unsigned integer
typedef long long int LL; // 64 bit integer
typedef unsigned long long int  ULL; // 64 bit unsigned integer
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
const LL MOD = 1e9+7;

/* Fast I/O */
inline int scanInt() {
	int n = 0;
	char ch = getchar();
	int sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(int)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

inline LL scanLong() {
	LL n = 0;
	char ch = getchar();
	LL sign = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-')	sign = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9') {
		n = (n<<1)+(n<<3)+(LL)(ch-'0');
		ch = getchar();
	}
	return n*sign;
}

int main() {
	sll(n);
	string str; cin >> str;
	sll(k); k--;
	rep(i, 0, n) {
		if(str[i] != str[k])	str[i] = '*';
	}
	cout << str << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e9;
const static ll MAXN = 301;



int main(){
    int V[5] = {0, 0, 0, 0, 0};
    for(int i = 0; i < 3; i++){
        int a, b; cin >> a >> b;
        V[a]++;
        V[b]++;
    }
    for(int i = 1; i < 5; i++) if(V[i] == 3) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>

int main(){
    
    int a = 0;
    int i;
    int p, q, r;

    std::cin >> p >> q >> r;

    std::vector<int> v = { p ,q ,r};

    std::sort(v.begin(), v.end());
    
    for(i = 0; i <= 1; i++){
        a += v[i];
    }

    std::cout << a << std::endl;
}


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

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

  string text;
  int cnt = 0;
  for (;;) {
    cin >> text;
    
    if (text == "END_OF_TEXT") break;
    
    for (int i = 0; i < text.size(); i++) {
      text[i] = tolower(text[i]);
    }

    if (text == w) cnt++;
    
  }

  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 3180
A, B = list(map(int, input().split()))

import math

cond_A = [math.ceil((A * 100) / 8), ((A+1) * 100) /8]
cond_B = [math.ceil((B * 100) /10), ((B+1) * 100) /10]

if cond_B[0] < cond_A[1] and cond_A[0] < cond_B[1]:
    print(max(cond_A[0], cond_B[0]))
else:
    print(-1)




Measured memory_bytes: 3064
/*input
3 1
1 0
*/
#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;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)xize()
const ll maxn=2e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
pii arr[maxn];
int main(){
    int n,m;
    cin>>n>>m;
    int i=mypow(10,n-1);
    REP(j,m){
        cin>>arr[j].f>>arr[j].s;
    }
    if(n==1) i=0;
    for(;i<=mypow(10,n)-1;i++){
        string s=to_string(i);
        bool wk=0;
        REP(j,m){
            if(s[arr[j].f-1]!=arr[j].s+'0'){
                wk=1;
            }
        }
        if(!wk){
            cout<<s;
            return 0;
        }
    }
    cout<<-1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n; cin >> n;
	vll a(n); rep(i,n) cin >> a[i];
	SORT(a);
	vll s(n,0);
	s[0] = a[0];
	rep(i,n-1) s[i+1] = s[i]+a[i+1];
	int ans = 1;
	for(int i=n-2; i>=0; i--){
		ll x = s[i];
		if(a[i+1]<=x*2) ans++;
		else break;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
/*
ID: toooooEasy or RafaelSaddatimov
PROG:
*/
#include <bits/stdc++.h>
#define MAX 100005
#define MAXN 100005
#define MOD 1000000007
#define INF 21000000
#define EPS 1e-5
#define ll long long
#define F first
#define S second
#define all(a) a.begin(), a.end()
#define pb push_back
#define io ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;
pair<int, int> arr[MAX];
int n, m;

int main() {
    io;
    cin >> n >> m;
    for(int i=1; i<=m; ++i)
        cin >> arr[i].F >> arr[i].S;
    int res = 0;
    sort(arr + 1, arr + m + 1);
    int l = arr[1].F;
    int r = arr[1].S;
    for(int i=2; i<=m; ++i) {
        if(arr[i].F >= r) {
            res++;
            l = arr[i].F;
            r = arr[i].S;
            continue;
        }
        l = arr[i].F;
        r = min(r, arr[i].S);
    }
    printf("%d", res + 1);
}


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

#define int long long

const int MOD = 1e9+7;

string A, B, C;
int N;
vector<vector<int> > dp;

int dfs(int n, int r) {
  if ( dp[n][r] >= 0 ) return dp[n][r];
  if ( n == N-1 ) {
    int ret = 0;
    for ( int i = 1; i <= 9; i++ ) {
      if ( A[n] != '?' && A[n]-'0' != i ) continue;      
      for ( int j = 1; j <= 9; j++ ) {
	if ( B[n] != '?' && B[n]-'0' != j ) continue;
	if ( i+j+r >= 10 ) continue;	
	if ( C[n] == '?' ) {
	  ret++;
	} else {
	  if ( C[n]-'0' == i+j+r ) ret++;	  
	}
	ret %= MOD;
      }
    }
    return dp[n][r] = ret;
  } else {
    int ret = 0;
    for ( int i = 0; i <= 9; i++ ) {
      if ( A[n] != '?' && A[n]-'0' != i ) continue;      
      for ( int j = 0; j <= 9; j++ ) {
	if ( B[n] != '?' && B[n]-'0' != j ) continue;
	if ( C[n] == '?' ) {
	  ret += dfs(n+1, (i+j+r)/10);
	  ret %= MOD;	  
	} else {
	  if ( C[n]-'0' == (i+j+r)%10 ) ret += dfs(n+1, (i+j+r)/10);
	  ret %= MOD;	  
	}
      }
    }

    return dp[n][r] = (ret%MOD);    
  }
}

signed main() {
  while ( cin >> A, A != "0" ) {
    cin >> B >> C;
    N = A.size();
    dp = vector<vector<int> >(N+1, vector<int>(3, -1));    
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());    
    reverse(C.begin(), C.end());

    cout << dfs(0, 0)%MOD << endl;    
  }
  return 0;
}


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

int main(){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k<=a){
        cout << k << "\n";
        return 0;
    }else if(k<=a+b){
        cout << a << "\n";
        return 0;
    }else if(k<=a+b+c){
        cout << a-(k-a-b) << "\n";
        return 0;
    }
    return 0;
}

Measured memory_bytes: 3632
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let Lh = v[0];
	let Lw = v[1];
	let v:Vec<i32> = procon_read();
	let h = v[0];
	let w = v[1];
	println!("{}", Lh*Lw - h * Lw - w*Lh + h*w);
}

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

using std::cerr;
using std::endl;

inline int rd() {
  int x; scanf("%d", &x);
  return x;
}

const int N = 1e5 + 233;

int n, dis[N], tag[N], deg[N], stk[N], top, A[N], B[N];
std::vector<int> G[N];

int dfs(int x, int fa) {
  dis[x] = dis[fa] + 1;
  int ret = 0;
  for (int y : G[x]) if (y != fa) {
    int z = dfs(y, x);
    if (dis[z] > dis[ret])
      ret = z;
  }
  if (!ret) return x;
  return ret;
}

int find_path(int x, int fa, int t) {
  if (x == t) {
    tag[x] = 1;
    stk[++top] = x;
    return 1;
  }
  for (int y : G[x]) if (y != fa) {
    if (find_path(y, x, t)) {
      tag[x] = 1;
      stk[++top] = x;
      return 1;
    }
  }
  return 0;
}

inline void work(int st, int f[]) {
  if (stk[1] != st)
    std::reverse(stk + 1, stk + top + 1);
  int sum = 0, w = 0;
  for (int i = 1; i <= top; ++i) {
    int x = stk[i], s = G[x].size() - 1;
    if (i != 1 && i != top) s -= 1;
    for (int j = 1; j <= s; ++j)
      f[++w] = sum + j + 1;
    f[++w] = sum + 1;
    sum += s + 1;
  }
}

int main() {
  /// freopen("data", "r", stdin);
  n = rd();
  for (int i = 1; i < n; ++i) {
    int x = rd(), y = rd();
    G[x].push_back(y);
    G[y].push_back(x);
  }
  int x = dfs(1, 0), y = dfs(x, 0);
  find_path(x, 0, y);
  for (int x = 1; x <= n; ++x) {
    if (tag[x]) continue;
    int ok = 0;
    for (int y : G[x])
      if (tag[y]) {
        ok = 1; break;
      }
    if (!ok)
      return puts("-1"), 0;
  }
  work(x, A), work(y, B);
  for (int i = 1; i <= n; ++i) {
    if (A[i] < B[i] || i == n) {
      for (int j = 1; j <= n; ++j)
        printf("%d ", A[j]);
      break;
    }
    if (A[i] > B[i]) {
      for (int j = 1; j <= n; ++j)
        printf("%d ", B[j]);
      break;
    }
  }
  putchar('\n');
  return 0;
}



Measured memory_bytes: 14848