akhauriyash/Code-Regression huggingface dataset:
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	aa := make(infants, n)
	for i := 0; i < n; i++ {
		aa[i].v = getNextInt64(scanner)
		aa[i].i = i
	}
	sort.Sort(aa)
	ysp48 := makeInts(n+1, n+1)
	for i := 0; i < n; i++ {
		for j := 0; j < i+1; j++ {
			ysp48[j+1][i-j] = maxint(ysp48[j+1][i-j], ysp48[j][i-j]+aa[i].v*absint(int64(j-aa[i].i)))
		}
		for j := 0; j < i+1; j++ {
			ysp48[i-j][j+1] = maxint(ysp48[i-j][j+1], ysp48[i-j][j]+aa[i].v*absint(int64(n-1-j-aa[i].i)))
		}
	}
	var ans int64
	for i := 0; i <= n; i++ {
		ans = maxint(ans, ysp48[i][n-i])
	}
	fmt.Fprintln(writer, ans)
}
func makeInts(h, w int) [][]int64 {
	index := make([][]int64, h, h)
	data := make([]int64, h*w, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func maxint(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func absint(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

type infant struct {
	i int
	v int64
}

type infants []infant

func (a infants) Len() int           { return len(a) }
func (a infants) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a infants) Less(i, j int) bool { return a[i].v > a[j].v }


Measured memory_bytes: 25696
N = int(input())
both = 0 
cnt = 0
gA = 0
sB = 0
for _ in range(N):
    s = input()
    cnt += s.count('AB')
    if s[-1] == 'A': gA += 1
    if s[0] == 'B': sB += 1
    if s[0] == 'B' and s[-1] == 'A': both += 1
ans = min(gA, sB) + cnt
if both == gA and gA == sB and both != 0:
    ans -= 1
print(ans)
# print(cnt, gA, sB, both)


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

typedef long long ll;

typedef long double ld;

int main()
{
	int x[2], y[2];
	for (int i = 0; i < 2; ++i)
	{
		std::cin >> x[i] >> y[i];
	}
	int dx = x[1] - x[0];
	int dy = y[1] - y[0];
	std::cout << x[1] - dy << ' ' << y[1] + dx << ' ';
	std::cout << x[0] - dy << ' ' << y[0] + dx << '\n';
	return 0;
}

Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
vector<int> adj[100001];
bool visited[100001];
int ans[100001];
 
void bfs(){
    queue<int> q;
    q.push(1);
    visited[1] = true;
    
    while(q.size()){
        int cur = q.front(); q.pop();
        for(auto i : adj[cur]){
            if(!visited[i]){
                ans[i] = cur;
                q.push(i);
                visited[i] = true;
            }
        }
    }
}
int main()
{
	memset(visited,false,sizeof(visited));
	memset(ans,0,sizeof(ans));
	int nodes,edges;
	cin >> nodes >> edges;
	for(int i=0;i<edges;i++)
	{
		int u,v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	bfs();
	cout << "Yes\n";
	for(int i=2;i<=nodes;i++)
		cout << ans[i] << "\n";
}

Measured memory_bytes: 10592
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<=(end);i++)
#define REP(i, n) FOR(i,1,n)
#define IFOR(i, begin, end) for(int i=(end);i>=(begin);i--)
#define IREP(i, n) IFOR(i,1,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())

#define ll long long
using namespace std;

bool is_prime(int k)
{
    for(int j=2;j*j<=k;j++){
        if(k%j==0) {
            return false;
        }
    }
    return true;
}

int main()
{
	stringstream ss;
    // 入力
    string S;
    cin>>S;

    if(S[0]!='A') {
        cout<<"WA"<<endl;
        return 0;
    }

    int cnum=0;
    FOR(i,2,S.length()-2){
        if(S[i]=='C') cnum++;
    }
    if(cnum!=1){
        cout<<"WA"<<endl;
        return 0;        
    }

    int capnum=0;
    FOR(i,0,S.length()-1){
        if(S[i]>='A' && S[i]<='Z') capnum++;
    }

    if(capnum!=2){
        cout<<"WA"<<endl;
        return 0;        
    }

    cout<<"AC"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main (void)
{

    char T[3];
    char S[3];
    char c;
    int i,count=0;


    scanf("%s",S);
    //scanf("%c",&c);
    scanf("%s",T);


    for(i=0;i<3;i++){
        if(S[i]==T[i]){
            count++;
        }
    }

    printf("%d",count);



    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int n;
	string s;cin>>n>>s;
	int out_min = 0;
	int ct = 0;
	REP(i,n)
		if(s[i] == '<')ct++;
		else break;
	out_min = ct;ct=0;
	RREP(i,n)
		if(s[i] == '>')ct++;
		else break;
	out_min = min(out_min,ct);
	cout << n - out_min << endl;
  return 0;
}

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

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

  int S = 0;
  int x = N;
  while (x > 0) {
    S += x % 10;
    x /= 10;
  }

  if (N % S == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 8
#define _MAX 8
int main(void)
{
	int p[_MAX] = { 0 }, c[_MAX] = { 4,1,4,1,2,1,2,1 };
	while (scanf_s("%d %d %d %d %d %d %d %d", &p[0], &p[1], &p[2], &p[3], &p[4], &p[5], &p[6], &p[7]) != EOF) {
		int min, min_i, sum = 0;
		for (int i = 0; i < _MAX; ++i) {
			for (int j = 0; j < _MAX; ++j) {
				if (p[j] - c[(i + j) % _MAX] > 0)
					sum += p[j] - c[(i + j) % _MAX];
			}
			if (i == 0 || sum <= min) {
				if (i != 0 && sum == min) {
					for (int j = 0; j < _MAX; ++j) {
						if (c[(i + j) % _MAX] < c[(min_i + j) % _MAX]) {
							min_i = i;
							break;
						}
						else if (c[(i + j) % _MAX] > c[(min_i + j) % _MAX]) {
							break;
						}
					}
				}
				else { min = sum; min_i = i; }
			}
			sum = 0;
		}
		for (int i = 0; i < _MAX; ++i) {
			if(i != 0) printf(" ");
			printf("%d", c[(min_i + i) % _MAX]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 1192
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int r;
	scan(r);
	prin(3*r*r);
	return 0;
}


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

#define x first
#define y second

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

const int mod=1000000000+7;

int addm(int& a,int b) {return (a+=b)<mod?a:a-=mod;}

template<class T,class U> bool smin(T& a,U b) {return a>b?(a=b,1):0;}
template<class T,class U> bool smax(T& a,U b) {return a<b?(a=b,1):0;}

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

	cout << ct << endl;
}

Measured memory_bytes: 640
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    S = in_s()
    T = in_s()

    SN = len(S)
    TN = len(T)

    ans = []
    for i in range(SN - TN + 1):
        for j in range(TN):
            if S[i + j] == '?' or S[i + j] == T[j]:
                continue
            else:
                break
        else:
            ts = list(S)
            for j in range(TN):
                ts[i + j] = T[j]
            ans.append(ts)

    if len(ans) == 0:
        print('UNRESTORABLE')
    else:
        for i in range(len(ans)):
            ans[i] = ''.join(ans[i]).replace('?', 'a')
        print(sorted(ans)[0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    while (true) {
        val x = sc.nextInt()
        val y = sc.nextInt()
        if (x == 0 && y == 0) break
        println("${Math.min(x,y)} ${Math.max(x,y)}")
    }
}


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

int sumdig(int N){
  int sd = 0;
  while(N>0){
    sd += N%10;
    N/=10;
  }
  return sd;
}

int main(){
  int N,A,B;
  int a;
  int total = 0;
  cin >> N >> A >> B;
  for(int i = 0;i<N+1;i++){
    a =  sumdig(i);
    if(a >= A && a <= B) total+=i;
  }
  cout << total << endl;
}

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

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

int main() {
    ll n;
    cin >> n;
    vll nums(n);
    ll ans = 0;
    ll a, b;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b;
        ans += a;
        nums[i] = a + b;
    }
    sort(nums.begin(), nums.end());
    reverse(nums.begin(), nums.end());
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 1) {
            ans -= nums[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
N,D=map(int,input().split())
X=[list(map(int,input().split())) for i in range(N)]
a=0
from math import sqrt
for i in range(N-1):
    for j in range(i+1,N):
        d=0
        for x in range(D):
            d+=(X[i][x]-X[j][x])*(X[i][x]-X[j][x])
        if sqrt(d)%1==0:
            a+=1
print(a)

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;
import java.util.function.BinaryOperator;

import javax.rmi.ssl.SslRMIClientSocketFactory;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scan=new Scanner(System.in);
		int cnt=0;
		int n=scan.nextInt();
		int[] arr1=new int[n];
		
		for(int i=0;i<n;i++){
			arr1[i]=scan.nextInt();
		}
		Arrays.sort(arr1);
		
		int m=scan.nextInt();
		for(int i=0;i<m;i++){
			int t=scan.nextInt();
			if(binary(arr1,t))
				cnt++;
		}
		
		System.out.println(cnt);
	}

	private static boolean binary(int[] arr, int key) {
		// TODO Auto-generated method stub
		int low=0,high=arr.length;
		
		while(low<=high){
			int mid=(low+high)/2;
			if(arr[mid]>key)
				high=mid-1;
			else if(arr[mid]<key)
				low=mid+1;
			else return true;
		}
		return false;
	}

}



Measured memory_bytes: 67752
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1e18;

int A,B,C,D,E,N,M,K,L,R,X;
string s,t;

signed main() {
    IOS();
    cin>>N;
    int ma=0,ans=0;
    vint h(N);
    rep(i,0,N){
        cin>>h[i];
        if(ma<=h[i])ans++;
        chmax(ma,h[i]);
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

int main() {
    char ch;
    cin >> ch;

    switch (ch) {
    case 'A': ch = 'T'; break;
    case 'T': ch = 'A'; break;
    case 'G': ch = 'C'; break;
    case 'C': ch = 'G'; break;
    }
    cout << ch << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def Yes(): print("Yes"); return
def No(): print("No"); return

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def Base_10_to_n(X, n):
  if (int(X/n)):
    return Base_10_to_n(int(X/n), n)+[X%n]
  return [X%n]


#############
# Main Code #
#############

X,Y,Z = inputIL()

print((X-Z)//(Y+Z))

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

using namespace std;

const int N = 1e5 + 10 ;


char sir [ N ];
int noNodes ;
int crNode = 1 , nextNode = 2 , crGroup ;

int main(){

    scanf("%s",sir + 1 );

    noNodes = strlen( sir + 1  );


    for ( int i = 1 ; i < noNodes ; i++ ){
        if ( sir [ i ] != sir [ noNodes - i ] ){
            printf("-1");
            return 0 ;
        }
    }


    if ( sir [ 1 ] == '0' || sir [ noNodes ] != '0' ){
        printf("-1");
        return 0;
    }

    printf("1 2\n");

    crGroup = 2 ;
    nextNode = 3 ;
    while ( crGroup < noNodes ){
        if ( sir [ crGroup ] == '0' ){
            printf("%d %d\n",crNode , nextNode);

        }else{
            printf("%d %d\n",crNode , nextNode );
            crNode = nextNode ;
        }
        nextNode ++ ;
        crGroup ++ ;
    }


//    for ( int i = 2 ; i < noNodes ; i++ ){
//        if ( sir [ i ] == '0' ){
//            printf("%d %d\n",crNode , nextNode);
//        }else{
//            printf("%d %d\n",crNode , nextNode );
//            if ( nextNode + 1  <= noNodes ){
//                printf("%d %d\n",crNode , nextNode + 1);
//            }
//            crNode = nextNode + 1 ;
//            nextNode = crNode  ;
//        }
//        nextNode += 1 ;
//    }





    return 0;
}


Measured memory_bytes: 1536
#include <algorithm>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <string>
#include <vector>
#include <limits>
#include <queue>
#include <cmath>
#include <map>
#include <set>

using namespace std;

using ll = long long;

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    
    vector<ll> cnt(n, k);

    for (int i = 0; i < q; ++i) {
        int x;
        cin >> x;
        --x;
        ++cnt[x];
    }

    for (int i = 0; i < n; ++i) {
        if (cnt[i] - q > 0)
            cout << "Yes\n";
        else
            cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 1408
n = int(input())
tmp = input()
print(tmp)
a = [int(x) for x in tmp.split()]

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(x) for x in a]))

Measured memory_bytes: 7664
import java.io.*;
import java.util.StringTokenizer;

class Main {
    public static void main(String args[]) {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	try {
	    int n = Integer.parseInt(br.readLine());
	    for (int i=0;i<n;i++) {
		StringTokenizer st = new StringTokenizer(br.readLine());
		double x[] = new double[2];
		double y[] = new double[2];
		double r[] = new double[2];
		for (int j=0;j<2;j++) {
		    x[j] = Double.parseDouble(st.nextToken());
		    y[j] = Double.parseDouble(st.nextToken());
		    r[j] = Double.parseDouble(st.nextToken());
		}
		double rsum = r[0]+r[1];
		double rdif = Math.abs(r[0]-r[1]);
		double d = Math.sqrt(Math.pow(x[1]-x[0],2)+Math.pow(y[1]-y[0],2));

		int check;
		if (rsum<d) check = 0;
		else if (rdif<=d && rsum>=d) check = 1;
		else if (r[0]>r[1]) check = 2;
		else check = -2;
		System.out.println(check);
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	}
    } 
}

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

using namespace std;

int main() {

int n,m,x;
cin>>n>>m;
int sum = 0;
for (int i=0;i<m;i++){
    cin>>x;
    sum+=x;
}
if (n-sum>=0)
    cout<<n-sum;
else
    cout<<"-1";


}





Measured memory_bytes: 3632
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]

ans = float("inf")

for bit in range(1 << D):
    count = 0
    sum = 0
    rest = list(range(1, D+1))

    for i in range(D):
        if bit & (1 << i):
            sum += (i + 1) * pc[i][0] * 100 + pc[i][1]
            count += pc[i][0]
            rest.remove(i + 1)

    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], -(-(G - sum) // (max_num * 100)))
        count += n
        sum += n * max_num * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)


Measured memory_bytes: 9020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair <int,int> ii ;
typedef vector < ii > vii ;
typedef vector < vii > viii ;
#define rep(i,n)                   for( ll i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++) 
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define db double 
#define fi first
#define se second
const ll mod =1000000007;

ll dp[3000][3000];
ll dp1[3000][3000];

ll calc(ll a[], int i, int j);

ll calc2(ll a[], int i, int j) {
	if(i==j) return -a[i];
	if(i>j) return 0;
	if(dp1[i][j]!=-1) return dp1[i][j];
	dp1[i][j]=min(calc(a,i+1,j)-a[i], calc(a,i,j-1)-a[j]);
	return dp1[i][j];
}

ll calc(ll a[], int i, int j) {
	if(i==j) return a[i];
	if(i>j) return 0;
	if(dp[i][j]!=-1) return dp[i][j];
	dp[i][j]=max(a[i]+calc2(a,i+1,j), a[j]+calc2(a,i,j-1));
	return dp[i][j];
}

int main() {
	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
  	int n; cin>>n;
  	ll a[n];
  	rep(i,n) cin>>a[i];
  	memset(dp,-1, sizeof dp);
  	memset(dp1, -1, sizeof dp1);
  	cout<<calc(a,0,n-1);
}

Measured memory_bytes: 141056
using System;
using System.Diagnostics;

class Program
{
    const int TYPE_NUM = 26;

    static void Main(string[] args)
    {
        int i, j, k;
        Stopwatch sw = new Stopwatch();
        sw.Start();

        int d = int.Parse(Console.ReadLine());
        int[] c = new int[TYPE_NUM + 1];
        int[,] s = new int[d + 1, TYPE_NUM + 1];

        string[] strInput = Console.ReadLine().Split(' ');
        for (i = 1; i <= TYPE_NUM; i++)
        {
            c[i] = int.Parse(strInput[i - 1]);
        }

        for (i = 1; i <= d; i++)
        {
            strInput = Console.ReadLine().Split(' ');
            for (j = 1; j <= TYPE_NUM; j++)
            {
                s[i, j] = int.Parse(strInput[j - 1]);
            }
        }

        int[] t = new int[d + 1];

        int[] choiceCandidate = new int[TYPE_NUM + 1];




        int result = 0;
        int[] last = new int[TYPE_NUM + 1];
        int resultDiff;
        int maxNo = 0;
        int maxDiff;

        int[] initChoice = new int[d + 1];

        for (i = 1; i <= d; i++)
        {
            maxNo = 0;
            maxDiff = int.MinValue;
            for (j = 1; j <= TYPE_NUM; j++)
            {
                choiceCandidate[j] = s[i, j];
                resultDiff = 0;
                for (k = 1; k <= TYPE_NUM; k++)
                {
                    if(k != j)
                    {
                        resultDiff += c[k] * (i - last[k]);
                    }
                }
                choiceCandidate[j] -= resultDiff;
                if(maxDiff < choiceCandidate[j])
                {
                    maxDiff = choiceCandidate[j];
                    maxNo = j;
                }
            }



            result += choiceCandidate[maxNo];
            last[maxNo] = i;
            //Console.WriteLine("result:" + result);
            initChoice[i] = maxNo;
            //Console.WriteLine(maxNo);
        }

        int initResult = result;
        int change;
        int changeVal;
        int old;
        int oldVal;
        Random rand = new Random();

        while(sw.Elapsed.TotalMilliseconds <= 1900)
        {
            change = rand.Next(1, d+1);
            changeVal = rand.Next(1, TYPE_NUM+1);
            old = initChoice[change];

            initChoice[change] = changeVal;

            result = 0;
            for (i = 1; i <= d; i++)
            {
                result += s[i, initChoice[i]];
                last[initChoice[i]] = i;

                resultDiff = 0;
                for (j = 1; j <= TYPE_NUM; j++)
                {
                    resultDiff += c[j] * (i - last[j]);
                }
                result -= resultDiff;
            }
            if(result > initResult)
            {
                initResult = result;
            }
            else
            {
                initChoice[change] = old;
            }
        }

        for(i = 1; i <= d; i++)
        {
            Console.WriteLine(initChoice[i]);
        }

        return;
    }
}

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

#define INF 999999999
#define MAX_X 1000
#define MAX_Y 1000
#define MAX_HEALTH 10
struct status {
	int health;
	int x;
	int y;
	int minutes;
};

queue<status> bfs;
bool checked[12][1010][1010];//health,x,y
//int lastnum[11] = {0,0,0,0,0,0,0,0,0,0};
int maxhp = 0;
///queue???push??????
///??¢??????????????\??????????????¨?????????status?????´?????????????????????
bool PushToQueue(status a) {
	/*for (int i = 0;i < lastnum[a.health];i++) {
		if (checked[i].health == a.health && checked[a.health][i].x == a.x && checked[a.health][i].y == a.y && checked[a.health][i].minutes == a.minutes){
			cout << "health:" << a.health << "/" << i << "/" << lastnum[a.health] << endl;
			return true;
		} 
	}
	checked[a.health][lastnum[a.health]++] = a;*/
	if (checked[a.health][a.x][a.y] == true) return false;
	if (a.health < maxhp) return false;
	bfs.push(a);
	if (a.health > maxhp) {
		maxhp = a.health;
		//cout << "maxhp has changed to " << maxhp << endl;
	}
	checked[a.health][a.x][a.y] = true;
	return true;
}

int main() {
	for (int a = 0;a < 11;a++) {
		for (int b = 0;b < 1000;b++) {
			for (int c = 0;c < 1000;c++) {
				checked[a][b][c] = false;
			}
		}
	}

	int H , W , N;

	cin >> H >> W >> N;
	char data[H][W];
	
	for (int i = 0;i < H;i++) {
		cin >> data[i];
	}
	//cout << "A" << endl;
	//Find 'S'
	for (int y = 0;y < H;y++) {
		for (int x = 0;x < W;x++) {
			if(data[y][x] == 'S') {
				bfs.push((struct status) {1,x,y,0});
				goto getout;
			}
		}
	}


	getout:
	int result = INF;
	for (;;) {
		if (bfs.empty()) break;
		struct status popped = bfs.front();
		bfs.pop();
		//cout << popped.health << "/" << popped.x << "/" << popped.y << "/" << popped.minutes << "/" << endl;
		if (popped.health == N+1) {
			if (popped.minutes < result) {
				result = popped.minutes;
			}
		}
		else {
			for (int x = -1;x < 2;x++) {
				for (int y = -1;y < 2;y++) {
					if(x != 0 && y != 0) continue;
					if (popped.x + x < 0 || popped.x + x >= W || popped.y + y < 0 || popped.y + y >= H) continue;
					if (data[popped.y + y][popped.x + x] == 'X') continue;
					else if (data[popped.y + y][popped.x + x] == '.') {
						PushToQueue((struct status) {popped.health,popped.x + x,popped.y + y,popped.minutes + 1});
					}
					else {
						//cout << "*****************************factory" << endl;
						int factory = data[popped.y + y][popped.x + x] -48 ;
						//cout << data[popped.y + y][popped.x + x]<< endl;
						if (factory == popped.health) {
							//eat
							PushToQueue((struct status) {popped.health + 1,popped.x + x,popped.y + y,popped.minutes + 1});
						}
						else {
							//the mouse doesn't eat.
							PushToQueue((struct status) {popped.health,popped.x + x,popped.y + y,popped.minutes + 1});
						}
					}
				}
			}
		}
	}
	cout << result << endl;
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  
  int h[N+1];
  for (int i = 0; i< N; i++) {
    cin >> h[i+1];
  }
  
  bool g[N+1] = {false};

  
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;

    if (h[a] > h[b]) {
      g[b] = true; 
    } else if (h[a] < h[b]) {
      g[a] = true;
    } else {
      g[a] = true;
      g[b] = true;
    }
  }
  
  int ans = 0;
  for (int i = 1; i < N+1; i++) {
    if (!g[i]) ans++; 
  }
  

 
  cout << ans << endl;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X, Y;
  cin >> X >> Y;
  
  for (int a = 0; a <= X; a++) {
    int b = X-a;
    int ashi = 2*a + 4*b;
    if (ashi == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3592
from itertools import combinations_with_replacement
N, M, Q = map(int, input().split())
list1 = []
for i in range(Q):
    l = list(map(int, input().split()))
    list1.append(l)
ans = 0
list2 = [i for i in range(1, M+1)]
for l in combinations_with_replacement(list2, N):
    tmp = 0
    for i in range(Q):
        if l[list1[i][1]-1]-l[list1[i][0]-1]==list1[i][2]:
            tmp += list1[i][3]
    if tmp >= ans:
        ans = tmp
print(ans)


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

int main() {
  // input
  int n;  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  
  // count
  int count = 0;
  for (int i = 0; i < n; i++) {
    while (a.at(i) % 2 == 0) {
      count++;
      a.at(i) /= 2;
    }
  }
  
  // output
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
h = list(map(int, readline().split()))
m = map(int, read().split())

h = [0] + h
t = [0] * (n+1)
cnt = 0

for a, b in zip(m, m):
    t[a] = max(t[a], h[b])
    t[b] = max(t[b], h[a])

for i in range(n+1):
    if h[i] > t[i]:
        cnt += 1

print(cnt)


Measured memory_bytes: 25048
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a==b&&b!=c) cout<<"Yes"<<endl;
    else if(b==c&&c!=a) cout<<"Yes"<<endl;
    else if(c==a&&a!=b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main() {
    int h, w;
    while(true) {
        cin >> h >> w;
	if(h==0 && w==0) break;

	for(int i=0; i<h; i++){
	    for(int j=0; j<w; j++){
	        if(i%2 == j%2) cout << '#' << flush;
		else cout << '.' << flush;
		if(j==w-1) cout << endl;
	    }
	}

	cout << endl;
    }
}

Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k;
    scanf("%d%d%d",&n,&m,&k);
    int flag=0;
    for(int b=0;b<=m;b++)
    {
        if(m==2*b)
        {
            if(k==b*n)
            {
                flag=1;
                break;
            }
        }
        else if((k-b*n)%(m-2*b)==0&&(k-b*n)*(m-2*b)>=0&&(k-b*n)/(m-2*b)<=n)
        {
            flag=1;
            break;
        }
    }
    if(flag==0)
        printf("No");
    else
        printf("Yes");
    return 0;
}


Measured memory_bytes: 256
function main(input){
    let lines = input.split("\n")
    let i=0;
    let line = lines[i].split(" ");
    while(line[1]!=="?"){
            line = lines[i].split(" ");
        let num1 = parseInt(line[0]);
        let num2 = parseInt(line[2]);
        let op = line[1];
        if(op==="+"){
            console.log(num1+num2);
        }else if(op==="-"){
            console.log(num1-num2);
        }else if(op==="*"){
            console.log(num1*num2);
        }else if(op==="/"){
            console.log(Math.floor(num1/num2));
        }
        
        i++;
    }
    
}


main(require("fs").readFileSync("/dev/stdin","utf-8"));


Measured memory_bytes: 15408
import sys
range = xrange
input = raw_input

S = input()
start = []
end = []
par = 1

q = int(input())
for _ in range(q):
    quer = input()
    if quer == '1':
        par ^= 1
    else:
        _, f, c = quer.split()
        f = int(f) - 1
        if par ^ f:
            start.append(c)
        else:
            end.append(c)

T = ''.join([''.join(reversed(start)), S, ''.join(end)])

if par:
    print T
else:
    print T[::-1]


Measured memory_bytes: 52636
#include <cstdio>
#include <cstring>

using namespace std;

char s[1000002];

int main(){
    scanf("%s", s);
    int ans = 0, begin = 0, end = strlen(s) - 1;
    while(begin < end){
        if(s[begin] == s[end]){
            begin++;
            end--;
        }else if(s[begin] != s[end]){
            if(s[begin] == 'x'){
                begin++;
                ans++;
            }else if(s[end] == 'x'){
                end--;
                ans++;
            }else{
                printf("-1");
                return 0;
            }
        }
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
import copy
from functools import reduce
k,n=map(int,input().split())
a=list(map(int,input().split()))
c=copy.copy(a)
c.insert(0,0)
a.insert(n,(k+a[0]))
b=list(map(lambda a,b:a-b,a,c))
d=reduce(lambda a,b:b if b>a else a,b)
print(k-d)

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

int main(){
  string s;
  cin >> s;
  bool can = false;
  if(s[0]==s[1]) can = true;
  if(s[1]==s[2]) can = true;
  if(s[2]==s[3]) can = true;
  if(can) cout << "Bad" << endl;
  else cout << "Good" << endl;
  return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.meta;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;

long solve(ref int N, ref int M, ref int P, ref int[] A, ref int[] B, ref int[] C) {
    auto cost = new long[](N + 1);
    auto used = new bool[](N + 1);

    fill(cost, long.max);
    cost[1] = 0;
    used[1] = true;

    foreach (t; 0 .. (2 * N)) {
        foreach (a, b, c; zip(A, B, C.map!(x => P - x))) {
            if (used[a] && cost[b] > cost[a] + c) {
                cost[b] = cost[a] + c;
                used[b] = true;
                if (b == N && t >= N)
                    return -1;
            }
        }
    }

    return max(0, -cost[N]);
}

void main() {
    int N;
    readf(" %d", &N);
    int M;
    readf(" %d", &M);
    int P;
    readf(" %d", &P);
    int[] A = new int[](cast(uint) M);
    int[] B = new int[](cast(uint) M);
    int[] C = new int[](cast(uint) M);
    for (int i = 0; i < M; i++) {
        readf(" %d", &A[i]);
        readf(" %d", &B[i]);
        readf(" %d", &C[i]);
    }
    auto ans = solve(N, M, P, A, B, C);
    writeln(ans);
}


Measured memory_bytes: 380
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;
    out(n*(n-1)/2 + m*(m-1)/2);
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> l(2*n);
	for( auto &k : l ) cin >> k;
	sort( l.begin(), l.end() );
	int sum = 0;
	for( int i = 0; i < 2*n; i += 2 ){
		sum += l[i];
	}
	cout << sum << endl;
	return 0;
}

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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (a >= b) {
        cout << "delicious" << endl;
    } else if (b - a <= x) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define pb push_back
#define mp make_pair
const int N = 1e5 + 7;
int n, m, rk[N];
vector <pair<int, int> > a[N];
ll ans[N];
bool cmp(pair<int, int> a, pair<int, int> b) {
	return a.first < b.first;
}
int cal(ll x) {
	int rt = 0; ll t = x;
	while (t > 0) {
		++rt;
		t /= 10;
	}
	return rt;
}
int main() {
	scanf("%d%d", &n, &m);
	rep(i, 1, m) {
		int p, y;
		scanf("%d%d", &p, &y);
		a[p].pb(mp(y, i));
		ans[i] = p * 1e6;
	}
	rep(i, 1, n) {
		sort(a[i].begin(), a[i].end(), cmp);
		// cout << '!' << i << '\n';
		for (int j = 0; j < (int)a[i].size(); ++j) {
			// cout << a[i][j].first << ' ' << a[i][j].second << '\n';
			rk[a[i][j].second] = j + 1;
		}
		// cout << '\n';
	}
	rep(i, 1, m) {
		// cout << rk[i] << '\n';
		ll res = ans[i] + rk[i];
		int tmp = cal(res);
		rep (j, 1, 12 - tmp) printf("0");
		printf("%lld\n", res);
	}
	return 0;
}

Measured memory_bytes: 8192
n,W=map(int,input().split())

ans=[[0]*(W+1) for _ in range(n)]

for i in range(0,n):
    w,v=map(int,input().split())
    for j in range(1,W+1):
        p=0
        if j>=w :
            p=ans[i-1][j-w]+v
        ans[i][j]=max(ans[i-1][j],p)

print(ans[-1][W])



Measured memory_bytes: 147968
#include <stdio.h>

int main(void){
    
    int n,m,X,Y,x[1000],y[1000],max,min;
    max=-101;
    min=101;
    
    scanf("%d %d %d %d",&n,&m,&X,&Y);
    
    for(int i=0; i<n; i++){
        scanf("%d",&x[i]);
        if(x[i]>max)
            max=x[i];
    }
    for(int j=0; j<m; j++){
        scanf("%d",&y[j]); 
        if(y[j]<=min)
            min=y[j];
    }
    
    if(min>max && X<max && min<=Y)
        printf("No War");
    else
        printf("War");
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint A, B, N;
	cin >> A >> B >> N;
	lint ans = 0;
	lint x = 0;
	if (B-1 <= N) {
		x = B - 1;
	}
	else {
		x = N;
	}
		cout << ((A * (x % B)) - (A * (x % B) % B)) / B << endl;
 }

Measured memory_bytes: 3632
import sys
# from collections import defaultdict, deque
# import math
# import copy
# from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    a,b,c = getList()
    for i in range(1, b * 101):
        if (a * i) % b == c:
            print("YES")
            return
    print("NO")
    return
def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()


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

using namespace std;

using ll = long long;

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

    int n, a;
    cin >> n >> a;

    vector<int> x(n);
    for (int i = 0; i < n; ++i) cin >> x[i];

    const int MAX_SUM = 50 * 50 + 50;
    vector<vector<ll>> dp(n + 1, vector<ll>(MAX_SUM));
    dp[0][0] = 1;
    for (int i = 1, sum = 0; i <= n; ++i) {
        for (int j = i - 1; 0 <= j; --j) {
            for (int k = 0; k <= sum; ++k) {
                dp[j + 1][k + x[i - 1]] += dp[j][k];
            }
        }
        sum += x[i - 1];
    }

    ll res = 0;
    for (int i = 1; i <= n; ++i)
        res += dp[i][a * i];
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1280
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}




int n,ans;

int get( int x ){
    int cnt = 0;
    while(x>0){
        x/=10;
        cnt++;
    }
    return cnt%2;
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);


    cin >> n;
    for(int i=1;i<=n;i++){
        ans+= get(i);
    }
    cout << ans << endl;




return 0;
}
///....




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

int main() {
  string S;
  
  int x,z;
  char y;
  
  cin >> y;
  if ( y == 'a' || y == 'e' || y == 'i' || y == 'o' || y == 'u' ) {
    cout <<"vowel" << endl;
  }
  else
    cout <<"consonant" << endl;
}
  



Measured memory_bytes: 256
#include <stdio.h>

int gcd(int, int);

int main(){
    int x, y, z;
    scanf("%d%d", &x, &y);
    
    z = gcd(x, y); // 最大公約数を求める
    
    printf("%d\n", z);  // 最大公約数を表示
}

int gcd(int x, int y){
    int z, str;
    if(x < y) { // x > y として計算するため
        str = y; y = x; x = str; // xとyを交換
    }
    // ユークリッドの互除法を実行 //
    while(y > 0){
        z = x % y; // xをyで割った余りを求める
        
        // 次のループで新しく割り算を実行するため新しくxとyをセットする
        x = y;
        y = z;
    }
    return x;
}


Measured memory_bytes: 2712
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	string s;
	cin >> s;
	ll ans = INF;
	REP(i, 26){
		char x = 'a' + i;
		ll max = 0;
		ll tmp = 0;
		string t = x + s + x;
		REP(j, t.size()){
			if(t[j] != x) tmp++;
			if(t[j] == x){
				if(tmp >= max) max = tmp;
				tmp = 0;
			}
		}
		if(ans > max) ans = max;
	}
	cout << ans << endl;
				
	return 0;
}


Measured memory_bytes: 256
def calcDebt(n)
  m = 100000.to_f
  for i in 0..n - 1
    m *= 1.05
    if (m % 1000 != 0)
      m += 1000 - (m % 1000)
    end
  end

  return m.to_i
end

n = gets.to_i

puts calcDebt(n)

Measured memory_bytes: 6112
#include <iostream>

using namespace std;

int main() 
{
    int a, b, temp, i;
    for(i=1; i<=3000; i++)
    {
    
    cin >> a >> b;
    
    if(a==0 && b==0)
    break;
    
    if(a > b)
    {
        temp =a;
        a = b;
        b = temp;
    }
    
    cout<< a << " " << b << endl;
    }
}


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


int main(){
    int n;  cin >> n;
    string s;
    int all=0;
    
    cin >> s;

    for(int i=0;i<n-1;i++){
            if( s.at(i) != s.at(i+1) ){
                all++;
            }
    }

    cout << all +1 << endl;
}




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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int h, n;
    cin >> h >> n;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        h -= a;
    }

    cout << (h <= 0 ? "Yes" : "No") << "\n";

    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

signed main() {

    int x1,y1,x2,y2,x3,y3,x4,y4;

    int tX,tY;

    cin >> x1 >> y1 >> x2 >> y2;

    tX = x1-x2;
    tY = y1-y2;

    x3 = tY + x2;
    y3 = -tX + y2;


    x4 = x3 + x1-x2;
    y4 = y3 + y1-y2;

    cout << x3 << " " << y3 <<" " << x4 << " " << y4;
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	while(cin >> n){
		ll maxn=n-1;
		for(ll i=sqrt(n);i>1;i--){
			if(i*(n/i)==n){
				maxn=min(i+(n/i)-2,maxn);
				break;
			}
		}
		cout << maxn << endl;
	}
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
result = 0
while True:
  start = n
  for i in range(n):
    if h[i] != 0:
      start = i
      break
  if start == n:
    break
  end = n - 1
  for i in range(start, n):
    if h[i] == 0:
      end = i - 1
      break
    h[i] -= 1
  result += 1
print(result)



Measured memory_bytes: 3060
import math

def resolve():
    A, B = map(int, input().split())  

    # max
    X_MAX = int(100 / 0.08)
    Y_MAX = int(100 / 0.10)

    x = int(A / 0.08)
    y = int(B / 0.10)


    for i in range(1, Y_MAX + 1):
        if int(i * 0.08) == A and int(i * 0.10) == B:
            print(i)
            return

    '''
    while x < X_MAX:
        y = int(B / 0.10)
        print("x: " + str(x))
        if x == y:
            print(x)
            return
        while y < Y_MAX:
            print(" y: " + str(y))
            y = y * 2
            if x == y:
                print(x)
                return
        x = x * 2
    '''
    print('-1')


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3188