akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main() {
int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	int sum = 0;
 
	for (int i=1; i<=n; i++){
		int c = 0;
		int temp = i;
		for (int j=0; j<5;j ++){
			c += temp % 10;
			temp /= 10;
		}
		if (c >= a && c <= b){
			sum += i;
		}
	}
 
	printf("%d\n", sum);
 
}


Measured memory_bytes: 1736
n,m = map(int,input().split())
h= list(map(int,input().split()))
ans = [1]*n

for i in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  if h[a]>=h[b]:
    ans[b]=0
  if h[a]<=h[b]:
    ans[a]=0
print(sum(ans))

Measured memory_bytes: 20104
#include<iostream>//<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s=0;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int a;
		cin>>a;
		s+=a;
	}
	if(n<s)
	{
		cout<<"-1";
		return 0;
	}
	cout<<n-s;
} 

Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#define INF 100000000
#define MOD 1000000007
using namespace std;


int main(){
    int a[4];
    for(int i=0; i<4; i++){
        char c;
        cin >> c;
        a[i]=c-'0';
    }
    
    for(int i=0; i<2; i++){
        for(int k=0; k<2; k++){
            for(int m=0; m<2; m++){
                
                int b[4];
                b[0]=a[0];
                b[1]=a[1];
                b[2]=a[2];
                b[3]=a[3];
                
                if(i){b[1]*=-1;}
                if(k){b[2]*=-1;}
                if(m){b[3]*=-1;}
                
                if(b[0]+b[1]+b[2]+b[3]==7){
                    cout<<b[0];
                    for(int s=1; s<4; s++){
                        if(b[s]>=0){
                            cout<<'+';
                        }
                        cout<<b[s];
                    }
                    cout<<"=7";
                    cout<<endl;
                    return 0;
                    
                }
                
            }
        }
    }
    
    return 0;
}


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

string S;

int main() {
    cin >> S;
    int N = S.length();
    int ans[N];
    memset(ans, 0, sizeof(ans));

    bool is_R = true;
    int R_cnt = 0;
    int L_cnt = 0;
    int pre_L;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            R_cnt++;
            if (S[i+1] == 'L') {
                ans[i] += (R_cnt/2 + R_cnt%2);
                ans[i+1] += R_cnt/2;
                pre_L = i+1;
                R_cnt = 0;
            }
        }
        else {
            L_cnt++;
            if (i == N-1 || S[i+1] == 'R') {
                ans[pre_L] += (L_cnt/2 + L_cnt%2);
                ans[pre_L - 1] += L_cnt/2;
                L_cnt = 0;
            }
        }
    }

    for (int i = 0; i < N; i++) {
        cout << ans[i] << " ";
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 1024
d, n = map(int, input().split())
 
if d == 0:
    if n == 100:
        print(n+1)
    else:
        print(n)
elif d == 1:
    if n == 100:
        print((n+1)*100)
    else:
        print(n*100)
elif d == 2:
    if n == 100:
        print((n+1)*10000)
    else:
        print(n*10000)

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#define REP(i, n) for(LL i = 0;i < n;i++)
#define REPR(i, n) for(LL i = n;i >= 0;i--)
#define FOR(i, m, n) for(LL i = m;i < n;i++)
#define FORR(i, m, n) for(LL i = m;i >= 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 all(x) (x).begin(),(x).end()
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*************** using variables ***************/
int n;
vector<int> f, a, t, x, y;
/**********************************************/

int main(){
    cin >> n;
    f.resize(n);
    a.resize(n);
    t.resize(n);
    x.resize(n);
    y.resize(n);

    REP(i, n){
        cin >> f[i] >> a[i] >> t[i] >> x[i] >> y[i];
    }
    
    pair<int, int> pre;
    double max_pass_0 = -1, max_pass_1 = -1, max_time_0 = -1, max_time_1 = -1;
    pre.first = t[0]; pre.second = a[0];
    FOR(i, 1, n){
        if(pre.first == t[i] && pre.second != a[i]){
            double dis = sqrt(pow(x[i-1] - x[i], 2) + pow(y[i-1] - y[i], 2));
            double times = (f[i] - f[i-1])/60.0;
            if(t[i] == 0){
                if(max_pass_0 < dis){
                    max_pass_0 = dis;
                    max_time_0 = times;
                }else if(max_pass_0 == dis){
                    if(max_time_0 == -1 || max_time_0 > times) max_time_0 = times;
                }
            }else{
                if(max_pass_1 < dis){
                    max_pass_1 = dis;
                    max_time_1 = times;
                }else if(max_pass_1 == dis){
                    if(max_time_1 == -1 || max_time_1 > times) max_time_1 = times;
                }
            }
        }
        pre.first = t[i]; pre.second = a[i];
    }
    printf("%.4f %.4f\n", max_pass_0, max_time_0);
    printf("%.4f %.4f\n", max_pass_1, max_time_1);
    //cout << max_pass_0 << " " << max_time_0 << endl;
    //cout << max_pass_1 << " " << max_time_1 << endl;
}

Measured memory_bytes: 3224
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);       
		int n = sc.nextInt();
		int m = sc.nextInt();
        int L = 1;
        int R = n;
        for(int i=0;i<m;i++){int l = sc.nextInt();
                             int r = sc.nextInt();
                             L=Math.max(L,l);
                             R=Math.min(R,r);
                            }
	    System.out.println(Math.max(R-L+1,0));
  }
}


Measured memory_bytes: 62952
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

def get_score(_type):
    last = [-1] * 26
    S = 0
    for d in range(D):
        S += s[d][_type[d]]

        last[_type[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])

    return S

base_types = []
last = [-1] * 26
S = 0
for d in range(D):
    # search type
    M = -float('inf')
    for tt in range(26):
        _last = last[:]
        tmp = s[d][tt]

        _last[tt] = d
        for i in range(26):
            tmp -= c[i] * (d - _last[i])

        if tmp > M:
            M = tmp
            M_tt = tt

    S += s[d][M_tt]

    last[M_tt] = d
    for i in range(26):
        S -= c[i] * (d - last[i])
    base_types.append(M_tt)


types = []
last = [-1] * 26
S = 0
for d in range(D):
    # search type
    seq = []
    for tt in range(26):
        _last = last[:]
        tmp = s[d][tt]

        _last[tt] = d
        for i in range(26):
            tmp -= c[i] * (d - _last[i])

        seq.append([tmp, tt])

    seq.sort(reverse=True)

    for i in range(10):
        tt = seq[i][1]
        tmp = base_types[:]
        tmp[d] = tt

        types.append(tmp)

M = -float('inf')
for _type in types:
    MM = get_score(_type)
    if MM > M:
        ans = _type
        M = MM
for _ans in ans:
    print(_ans + 1)


Measured memory_bytes: 80284
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll inf=(ll)1e18;
ll dp[401][401],pre[401];

int main(){
  ios::sync_with_stdio(0);
  cin.tie(NULL); cout.tie(NULL); 
  ll n,k,i,j,a,l,r;
  cin>>n; pre[0]=0;
  for(i=1;i<=n;i++){
    cin>>pre[i]; pre[i]+=pre[i-1];
    for(j=1;j<=n;j++)
     dp[i][j]=inf;
    dp[i][i]=0;
  }
  for(ll gap=1;gap<n;gap++)
   for(i=1;i<=n;i++)
    {
      l=i,r=min(i+gap,n);
      for(j=l;j!=r;j++)
       dp[l][r]=min(dp[l][r],dp[l][j]+dp[j+1][r]+ pre[r]- pre[l-1]) ;
    }
  cout<<dp[1][n];
}

Measured memory_bytes: 1536
package main

import "fmt"

func main() {
	var a, b int
	var op string
	var ans int

	for {
		fmt.Scan(&a, &op, &b)
		if op == "?" {
			break
		}
		switch op {
		case "+":
			ans = a + b
		case "-":
			ans = a - b
		case "*":
			ans = a * b
		case "/":
			ans = a / b
		default:
			fmt.Println("op is incorrect")
		}
		fmt.Println(ans)
	}
}



Measured memory_bytes: 1128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;

int main(){
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);

    int nb = 0;
    string s;
    cin >> s;
    int n = sz(s);
    ll cnt = 0;
    rep(i,0,n){
        if(s[i] == 'B'){
            nb++;
            cnt += n-nb-i;
        }
    }

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


Measured memory_bytes: 720
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    int N, Q;
    int[] A, B, C;
    private void solve() {
        N = nextInt();
        A = nextIntArray(N);

        Q = nextInt();
        B = new int[Q];
        C = new int[Q];
        for(int i = 0;i < Q;i++) {
            B[i] = nextInt();
            C[i] = nextInt();
        }

        long S = 0;
        for(int i = 0;i < N;i++) {
            S += A[i];
        }

        int[] cnt = new int[100000 + 1];
        for(int i = 0;i < N;i++) {
            cnt[A[i]]++;
        }

        for(int i = 0;i < Q;i++) {
            int b = B[i];
            int c = C[i];


            if (b > c) {
                long sub = (long)(b - c) * cnt[b];
                S -= sub;
            } else {
                long add = (long)(c - b) * cnt[b];
                S += add;
            }

            out.println(S);

            cnt[c] += cnt[b];
            cnt[b] = 0;
        }
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] x = new int[n];
        for(int i = 0;i < n;i++) {
            x[i] = nextInt();
        }
        return x;
    }

    public long[] nextLongArray(int n) {
        long[] x = new long[n];
        for(int i = 0;i < n;i++) {
            x[i] = nextLong();
        }
        return x;
    }

    public double[] nextDoubleArray(int n) {
        double[] x = new double[n];
        for(int i = 0;i < n;i++) {
            x[i] = nextDouble();
        }
        return x;
    }
}

Measured memory_bytes: 54536
#include<stdio.h>

void swap (long int *x, long int *y) {
  long int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}


int partition (long int array[], long int left, long int right) {
  long int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (long int array[], long int left, long int right) {
  long int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(void){
 long int K, N, count=0, i;
  scanf("%ld %ld", &N, &K);
long int k[N];
  for(i=0; i<N; i++){
    scanf("%ld", &k[i]);
  }
  
  //printf("%d\n", k[0]);
  
  quick_sort(k, 0, N-1);
  
  for(i=0; i<N-K; i++){
    count += k[i];
  }
  
  printf("%ld\n", count);
  
  return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define ll long long
#define uint unsigned
#define ull unsigned ll
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator
 
#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define y1 wzpakking
#define fi first
#define se second
#define BG begin
#define ED end
 
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?(x)-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define sqr(x) (1ll*x*x)
 
#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
#define inf 2147480000
using namespace std;
char s[100005];
int cnt[30],n;
int main(){
	scanf("%d%s",&n,s+1);
	For(i,1,n) cnt[s[i]-'a']++;
	int ans=1;
	For(i,0,25) ans=1ll*ans*(cnt[i]+1)%1000000007;
	printf("%d\n",(ans+1000000006)%1000000007);
} 

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int i,n,k,p,r;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d",&k,&p);
		r=k%p;
		if(r==0){
			r=p;
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 2628
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


while True:

    N = int(input()) #量
    if N == 0:
        break

    ans = BIG_NUM

    lim_A = N//200
    lim_B = N//300
    lim_C = N//500

    for a in range(lim_A+1):
        for b in range(lim_B+1):
            if 200*a+300*b > N:
                break
            rest = N-(200*a+300*b)
            if rest%500 != 0:
                continue
            c = rest//500

            sum_A = 380*(a%5)+304*(a-(a%5))
            sum_B = 550*(b%4)+935*(b-(b%4))//2
            sum_C = 850*(c%3)+1496*(c-(c%3))//2

            ans = min(ans,sum_A+sum_B+sum_C)

    print("%d"%(ans))


Measured memory_bytes: 13748
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	long long a, b, c;
	cin >> a >> b >> c;
	string ans;
	ll temp = c - a - b;
	if(temp < 0){
		cout << "No" << endl;
		return 0;
	}
	unsigned long long temp2 = temp;
	if(temp2 != 0 && temp2*temp2/temp2 != temp2){
		cout << "Yes" << endl;
		return 0;
	}
	if(4ULL*(unsigned long long)a*(unsigned long long)b < temp2 * temp2) ans = "Yes";
	else ans = "No";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,c,d,n,count;

	while(scanf("%d",&n)!=EOF) {
		count=0;
		for(a=0;a<=9;a++) {
			for(b=0;b<=9;b++) {
				for(c=0;c<=9;c++) {
					for(d=0;d<=9;d++) {
						if(a+b+c+d==n) {
							count++;
						}
					}
				}
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 596
def main():
    INF = float("inf")

    N, M, *ABC = map(int, open(0).read().split())

    D = [0] + [INF] * (N - 1)
    E = [(a - 1, b - 1, -c) for a, b, c in zip(*[iter(ABC)] * 3)]

    for a, b, c in E:
        D[b] = min(D[b], D[a] + c)

    ans = D[-1]

    for a, b, c in E:
        D[b] = min(D[b], D[a] + c)

    print("inf" if ans != D[-1] else -ans)

main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int A,B,C,X,goukei;
    cin >> A >> B >> C >> X;
    ll rs = 0;

    for(int i = 0;i <= A;i++)
        for(int j = 0;j <= B;j++)
            for(int k = 0;k <= C;k++){
                if(X == 500 * i + 100 * j + 50 * k)
                    rs++;
            }

    cout << rs << endl;

    

}

Measured memory_bytes: 3528
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n;
   cin >> n;

   if(n>999) cout << "ABD" << endl;
   else cout << "ABC" << endl;


   return 0;
}

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

int main() {
  int N;
  cin >> N;
  N--;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  vector<int> ans(N + 1);
  for (int i = 0; i < N; i++) {
    ans.at(A.at(i) - 1)++;
  }
  for (auto a : ans) cout << a << "\n";
}

Measured memory_bytes: 4816
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
int N,M,H,K;
struct edge{
	int to,cost,hour,c;
};
main()
{
	while(cin>>N>>M>>H>>K,N)
	{
		vector<vector<edge> >G(N);
		for(int i=0;i<M;i++)
		{
			int a,b,c,h,r;
			cin>>a>>b>>c>>h>>r;
			a--,b--;
			r--;
			G[a].push_back((edge){b,c,h,r});
			G[b].push_back((edge){a,c,h,r});
		}
		vector<int>D(1<<K);
		int s,t;cin>>s>>t;s--,t--;
		for(int muryo=0;muryo<1<<K;muryo++)
		{
			vector<vector<int> >d(H+1,vector<int>(N,1e9));
			d[0][s]=0;
			priority_queue<pair<int,pair<int,int> > >P;
			P.push({0,{0,s}});
			while(!P.empty())
			{
				int cost=-P.top().first;
				int ho=P.top().second.first;
				int u=P.top().second.second;
				P.pop();
				if(d[ho][u]<cost)continue;
				for(edge e:G[u])
				{
					int v=e.to;
					int nextho=ho+e.hour;
					int nextcost=cost+((muryo>>e.c)&1?0:e.cost);
					if(nextho>H||d[nextho][v]<=nextcost)continue;
					d[nextho][v]=nextcost;
					P.push({-nextcost,{nextho,v}});
				}
			}
			int ret=1e9;
			for(int i=0;i<=H;i++)ret=min(ret,d[i][t]);
			D[muryo]=ret;
		}
		int P;cin>>P;
		vector<pair<int,int> >pas(P);
		for(int i=0;i<P;i++)
		{
			int l,d;cin>>l>>d;
			int now=0;
			for(int j=0;j<l;j++)
			{
				int k;cin>>k;k--;
				now|=1<<k;
			}
			pas[i]=make_pair(d,now);
		}
		vector<int>dp(1<<K,1e9);
		dp[0]=0;
		for(int i=0;i<1<<K;i++)
		{
			for(int j=0;j<P;j++)
			{
				int nxt=i|pas[j].second;
				dp[nxt]=min(dp[nxt],dp[i]+pas[j].first);
			}
		}
		int ans=2e9;
		for(int i=0;i<1<<K;i++)ans=min(ans,dp[i]+D[i]);
		cout<<(ans<1e9?ans:-1)<<endl;
	}
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
ll n,k,s;
ll arr[N];
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>k>>s;
for(ll i=1;i<=n;i++)
{
if(i<=k)
arr[i]=s;
else{

if(s!=1e9)
arr[i]=s+1;
else
arr[i]=1;
}}
for(ll i=1;i<=n;i++)
cout<<arr[i]<<" ";
}


Measured memory_bytes: 2176
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N, M;
  cin >> N >> M;
  vi A(M);
  cin >> A;
  int S = accumulate(all(A), 0LL);
  if (S > N)
    cout << -1 << endl;
  else
    cout << (N - S) << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 3696
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        
        int ans = 0;
        for(int i = 1; i < n; i++){
            int low = 0;
            int high = n;
    
            while(high - low > 1){
                int mid = (low + high) / 2;
                if(ok(mid, i, n)){
                    low = mid;
                }else{
                    high = mid;
                }
            }
            
            int x = Math.max(low - i, 0);
            ans += x * 2;
            if((long) i * (long) i < n) ans += 1;
        }
        System.out.println(ans);
    }
    
    static boolean ok(long mid, long i, long n){
        return mid * i < n;
    }
}

Measured memory_bytes: 35656
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <deque>

bool atcg(char c) {
  return c == 'A' || c == 'T' || c == 'C' || c == 'G';
}

auto main() -> int {
  std::string S;
  std::cin >> S;

  const auto l = S.length();

  // DFS する
  std::deque<std::size_t> q{};

  // 初期の探索開始地点の登録
  for (auto i = 0u; i < l; ++i) {
    if (atcg(S[i])) q.emplace_back(i);
  }

  std::size_t f = 0;   // 探索済みインデックス
  std::size_t ans = 0; // 最長の部分文字列の長さ

  while (!q.empty()) {
    const auto s = q.front();
    q.pop_front();

    if (s < f) continue;

    // 何文字続くか
    std::size_t a = 1;
    auto i = s + 1;
    for (; atcg(S[i]) && i < l; ++i) {
      a++;
    }
    ans = std::max(ans, a);
    f = i;
  }

  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
vector<vector<ll>> dp;
ll n ;
vector<vector<ll>> mtch;
ll f(ll x,ll y){
    if(dp[x][y]!=INF) return dp[x][y];
    if(x==n-1){
        if(y==((1<<n)-1)){
            dp[x][y] = 1;
            return 1;
        }else{
            dp[x][y] = 0;
            return 0;
        }
    }
    bitset<21> yb(y),ybreset(y);
    ll ret = 0;
    for(int i=0;i<n;i++){
        yb = ybreset;
        if(yb.test(i)) continue;
        if(mtch.at(x+1).at(n-1-i) == 0) continue;
        yb.set(i,1);
        ll yu=yb.to_ullong();
        ret = (ret + f(x+1,yu)) % mod;
    }
    dp[x][y] = ret;
    return ret;
}

int main(){
    cin >> n;
    dp.resize(n,vector<ll>(1<<n,INF));
    mtch.resize(n,vector<ll>(n,0));
    rep(i,n) rep(j,n) cin >> mtch.at(i).at(j);
    ll ans = 0;
    for(int i=0;i<n;i++){
        ans = (ans + (f(0,(1<<i)) * mtch.at(0).at(n-1-i))) % mod;
    }
    /*
    rep(i,n){
        rep(j,1<<n){
            cout << dp[i][j] << " ";
        }
        cout <<"\n";
    }
    */
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 360832
#include<bits/stdc++.h>
using namespace std;
int main()
{

long long a,b;
long long count=0;
cin>>a;
b=a;
while(a){
	count+=a%10;
	a=a/10;
}
// cout<<count<<endl;

if (b%count==0)
{
	/* code */
	cout<<"Yes"<<endl;
}
else
cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 3624
n = int(input())
abc = [[0]*3 for _ in range(n)]
for i in range(n):
    abc[i] = list(map(int,input().split())) 
dp = [[0]*3 for _ in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1,n):
    for j in range(3):
        dp[i][j] = max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+abc[i][j]
print(max(dp[n-1]))

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

using namespace std;

int main() {
    bool isprime[55556];
    fill(isprime, isprime+55556, true);
    isprime[0] = isprime[1] = false;
    for(int p=2; p<235; p++) {
        if(isprime[p]) {
            for(int i=p*p; i<=55555; i+=p)
                isprime[i] = false;
        }
    }
    vector<int> primes;
    for(int i=2; i<=55555; i++) {
        if(isprime[i] && i%5==1) primes.push_back(i);
    }
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
        cout << primes[i] << (i==n-1 ? "\n" : " ");
}

Measured memory_bytes: 256
#include<stdio.h>


int main (void){
	
	int n,debt,i,amari;
	scanf("%d",&n);
	debt = 100000;
	for(i=0;i<n;i++){
		debt *=1.05;
		amari = debt%1000;
	if(amari != 0){
		debt = debt - amari + 1000;
	}
}
	printf("%d\n",debt);	
	
return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define double long double
#define endl '\n'
#define vll vector<ll>
#define vvl vector<vll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vppll vector<pll,pll>
#define mp make_pair
#define pb push_back
#define mapll map<ll,ll>
#define fir first
#define sec second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0);
#define fo(i,b) for(i=0;i<b;i++)
#define repa(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define all(x) (x).begin(), (x).end()
#define s(v) (ll)v.size()
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define Time cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n"
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
const long long int MAX = (ll)(1e18+1);
const long long int MIN = (ll)(-1e18-1);
const long long int mod = (ll)(1e9+7);
using namespace std;  // order_of_key(k) -> Number of elements strictly smaller than k
using namespace __gnu_pbds; // order_of_key() ; *( find_by_order() ) -> kth element in set;

ll max(ll a,ll b,ll c) {return max(max(a, b), c);}
ll min( ll a, ll b, ll c) { return min(min(a, b), c);}
ll max(ll a,ll b) {return (a>b) ? a : b;}
ll min(ll a,ll b) {return (a<b) ? a : b;}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power_mod(ll a, ll n, ll mod_){ ll p=1; while(n){ if(n%2){ p=(p*a)%mod_;} n/=2; a=(a*a)%mod_;} return p%mod_;}                 
                          /*Code Begins*/




int main(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    _cin;
    cout << setprecision(15);
    ll mn = MAX, mx = MIN;
    ll n, m, t,  k, i, j,  sum=0,  prev, flag=0, cnt=0;
    ll x=0, y=0, fx, diff, tot=0, l , r;
    int TC=1;
    // cin >> TC;
while(TC--){
    cin >> n;
    double pi = 3.14159265358979;
    double x = 2.0*pi*n;
    cout << x  << endl;


}

    Time;
    return 0;
}


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

int main(){
	char X[10000];
	while(1){
		int i,y=0;

		scanf("%s",X);
		if((X[0] == '0')&&(X[1] == '\0')) break;

		for(i=0; i<10000; i++){
			if(X[i] == '\0') break;
			y += X[i] - '0';
		}

		printf("%d\n",y);
	}

	return 0;
}

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

#define ll long long int
#define rep(i, a, n) for (int i = a; i < n; i++)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

void Print(bool c)
{
    if (c)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

ll gcdll(ll a, ll b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

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

bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vi cnt(n);
    rep(i, 0, q)
    {
        int a;
        cin >> a;
        cnt[a - 1]++;
    }
    rep(i, 0, n)
    {
        print(k - (q - cnt[i]) > 0);
    }
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
    int sum,a[100]={0},sum2=0,i;
    while(scanf("%d",&sum))
    {
        if(sum==0)break;
        for(i=0;i<9;i++)
        {
            scanf("%d",&a[i]);
            sum2+=a[i];
        }
        printf("%d\n",sum-sum2);
        sum2=0;
    }
    return 0;
}

Measured memory_bytes: 596
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
#include <complex>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

typedef complex<double> Point;
const static double EPS = 1e-12;

vector<P> edges[25][25][25*25];
int A[25*25][25*25];
int B[25*25];

int main(){
  for(int sy = 0; sy < 25; sy++){
    for(int sx = 0; sx < 25; sx++){
      for(int dy = 0; dy < 25; dy++){
        for(int dx = 0; dx < 25; dx++){
          edges[sy][sx][abs(dy-sy) + abs(dx-sx)].push_back(P(dx,dy));
        }
      }
    }
  }

  int cols;
  int rows;
  int proper_distance;
  while(~scanf("%d %d %d",&cols,&rows,&proper_distance)){
    if(cols == 0 && rows == 0 && proper_distance == 0) break;

    memset(A,0,sizeof(A));
    memset(B,0,sizeof(B));

    for(int y = 0; y < rows; y++){
      for(int x = 0; x < cols; x++){
        int status;
        scanf("%d",&status);
        B[y * cols + x] = status;
      }
    }

    for(int sy = 0; sy < rows; sy++){
      for(int sx = 0; sx < cols; sx++){
        A[sy * cols + sx][sy * cols + sx] = 1;
        for(int i = 0; i < edges[sy][sx][proper_distance].size(); i++){
          int dx = edges[sy][sx][proper_distance][i].first;
          int dy = edges[sy][sx][proper_distance][i].second;
          if(dx < 0 || dx >= cols || dy < 0 || dy >= rows) continue;
          A[sy * cols + sx][dy * cols + dx] = 1;
        }
      }
    }

    for(int round = 0; round < rows * cols; round++){

      int pivot = round;
      bool has_pivot= false;
      for(int row = round; row < rows * cols; row++){
        if(A[row][round] == 1){
          has_pivot = true;
          pivot = row;
          break;
        }
      }
      if(!has_pivot) continue;

      swap(A[pivot],A[round]);
      swap(B[pivot],B[round]);
      for(int row = 0; row < rows * cols; row++){
        if(round == row) continue;
        if(A[row][round] == 0) continue;

        B[row] ^= B[round];
        for(int col = round; col < rows * cols; col++){
          A[row][col] ^= A[round][col];
        }
      }
    }

    bool isok = true;

    for(int pos = 0; pos < cols * rows; pos++){
      if(A[pos][pos] == 0 && B[pos] == 1){
              isok = false;
              break;
      }
    }
    printf("%d\n",isok ? 1 : 0);
  }
}

Measured memory_bytes: 16416
#include <iostream>
#include <string>

bool isPal(std::string S)
{
  int L = S.length();
  for (int i=0; i<L/2; i++) {
    if (S[i] != S[L-1-i]) return false;
  }
  return true;
}

int main()
{
  std::string S;
  std::cin >> S;
  int L = S.length();
  if ( isPal(S) && isPal(S.substr(0, L/2)) && isPal(S.substr(1+L/2)) ) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int x,y;
	scanf("%d %d", &x, &y);
	if ((x == 2) || (y == 2))
		printf("No");

	else if((x == 1) || (x == 3) || (x == 5) || (x == 7) || (x == 8) || (x == 10) || (x == 12)){
		if((y == 1) || (y == 3) || (y == 5) || (y == 7) || (y == 8) || (y == 10) || (y == 12))
			printf("Yes");
		else
			printf("No");
	}

	else if((x == 4) || (x == 6) || (x == 9) || (x == 11)){
		if((y == 4) || (y == 6) || (y == 9) || (y == 11))
			printf("Yes");
		else
			printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = sorted([int(s) for s in input().split()])

memory = max([abs(int(p)-a[0]) for p in a])
for i in range(a[0]+1,a[n-1]+1):
    memory1 = max([abs(int(t)-i) for t in a])
    memory = min(memory,memory1)
print(memory)


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

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;

#define deb(x) cerr<<#x<<":"<<x<<"\n";
#define dvi(x) for(ll i=0;i<x.size();i++)cerr<<#x<<"["<<i<<"]:"<<x[i]<<" ";
#define iter(v) for(auto it:v)
#define wt ll t;cin>>t;while(t--)
#define rl(x) ll x;cin>>x;
#define rvi(x,n) vi x(n);for(ll i=0;i<n;i++) cin>>x[i];
#define rs(x) string x;cin>>x;
#define w(x) cout<<x<<endl;
#define wvi(x) for(ll i=0;i<x.size();i++) cout<<x[i]<<" ";cout<<endl;
#define ws(x) cout<<x<<endl;
#define all(v) v.begin(),v.end()
#define pb push_back
#define ppb pop_back
#define pll pair<ll, ll>
#define fo(i,n) for(ll i=0;i<n;i++)
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
const ll N = pow(2,32);

map<long long, long long> factorize(long long n) {	//returns map containing factor and multiplicity, Eg: 60 = {{2,2},{3,1},{5,1}}
	map<long long, long long> ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n > 1) {
		ans[n]++;
		n = 1;
	}
	return ans;
}

void FAST() {	//FAST Input Output, DONT use both scnaf,prllf / cin,cout , Use any ONE system
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    //    freopen("output.txt", "w", stdout);
    #endif
	FAST();
    rl(n) rl(x) rl(t)
    if(n%x)
    {
        cout<<(n/x+1)*t;
    }    	
    else cout<<(n/x)*t;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include <stdlib.h>
#define k 10000

int main(){
  unsigned short *A, *B;
  int C[k+1];
  int n, i, j;
  scanf("%d", &n);
  A=malloc(sizeof(short)*n-1);
  B=malloc(sizeof(short)*n-1);
  for(i=0; i<=k; i++){
    C[i]=0;
  }
  for(i=0; i<n; i++){
    scanf("%hu", &A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1; i<=k; i++){
    C[i]=C[i]+C[i-1];
  }

  for(j=1; j<=n; j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }
  
  for(i=1; i<=n; i++ ){
    if(i>1) printf(" ");
    printf("%d", B[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 9584
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<string>s(n);
  for(int i=0;i<n;i++){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  int cnt=1;
  for(int i=0;i<n-1;i++){
    if(s.at(i)!=s.at(i+1)){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 9528
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
signed main()
{
    int table[14] = {0, 13, 1, 2, 3, 
        4, 5, 6, 7, 8,
        9, 10, 11, 12};

    Int(a);
    Int(b);

    if (table[a] < table[b]) {
        cout << "Bob" << endl;
    } else if (table[a] == table[b]) {
        cout << "Draw" << endl;
    } else {
        cout << "Alice" << endl;
    }


    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[250];
int main()
{
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=2*n;i++)
	{
	   cin>>a[i];
	   for(int j=i-1;j>=1;j--)
	   {
	   	  if(a[j]>a[j+1])
	   	    swap(a[j],a[j+1]);
	   	  else break;
	   }
    }
    for(int i=1;i<=2*n-1;i+=2)
       sum+=a[i];
    cout<<sum;
	return 0;
} 

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

int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int turn = 1;
  while(true){
    if(turn % 2 == 1){
      c -= b;
    }
    else{
      a -= d;
    }
    if(a <= 0 || c <= 0){
      break;
    }
    turn++;
  }
  if(turn % 2 == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>

using namespace std;

int main(void){
    int all_money;
    int coin500 = 0;
    int changed_am = 0;
    int coin5 = 0;
    int all_happy_point = 0;

    cin >> all_money;

    coin500 = (all_money / 500);
    changed_am = all_money - (coin500 * 500);
    coin5 = (changed_am / 5);

    all_happy_point = (coin500 * 1000) + (coin5 * 5);
    
    cout << all_happy_point << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
li = list(map(int, input().split()))

a = b = 0
i = 0
j = len(li) - 1

while True:
  if i == j:
    if a <= b:
      a += li[i]
    else:
      b += li[i]
    break
  if a <= b:
    a += li[i]
    i += 1
  else:
    b += li[j]
    j -= 1

print(abs(a-b))

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int A, B;

  cin >> A >> B;

  if (max(A, B) >= 10) {
    cout << -1 << endl;
  } else {
    cout << A * B << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# coding: utf-8

S = str(input())

min = 1000000
base = 753
for i in range(len(S)):
  try:
    #print(S[i:i+3])
    x=abs(int(S[i:i+3])-753)
    if(min>x):
      min = x
  except:
    pass
print(min)

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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/*alias*/
//#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/

template<class Monoid> struct SegTree{
	using Func = function<Monoid(Monoid, Monoid)>;
	vector<Monoid> dat;
	int SIZE_R;
	const Func F;
	const Monoid UNITY;

	SegTree(int n, const Func f, const Monoid &unity): F(f), UNITY(unity){ init(n); }
	void init(int n){
		SIZE_R = 1;
		while(SIZE_R < n) SIZE_R *= 2;
		dat = vector<Monoid>(SIZE_R*2, UNITY);
	}

	void set(int a, const Monoid &v) { dat[a+SIZE_R] = v;}
	void build(){
		for(int k = SIZE_R -1; k > 0; --k){
			dat[k] = F(dat[k*2], dat[k*2+1]);
		}
	}

	void update(int a, const Monoid &v){
		int k = a + SIZE_R;
		dat[k] = v;
		while(k >>= 1){
			dat[k] = F(dat[k*2], dat[k*2+1]);
		}
	}

	Monoid get(int a, int b){
		Monoid vleft = UNITY, vright = UNITY;
		for(int left = a+SIZE_R, right = b+SIZE_R; left < right; left >>= 1, right >>= 1){
			if(left & 1) vleft = F(vleft, dat[left++]);
			if(right & 1) vright = F(dat[--right], vright);
		}
		return F(vleft, vright);
	}
	inline Monoid operator [] (int a){return dat[a+SIZE_R]; }
};

#define int int64_t
signed main()
{
    int n; cin >> n;
	SegTree<int64_t> seg(n, [](int64_t a, int64_t b){return GCD(a, b);}, 0);

	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
		seg.set(i, a[i]);
	}
	seg.build();

	int64_t ans{};
	for(int i = 0; i < n; ++i){
		int64_t left = seg.get(0,i);
		int64_t right = seg.get(i+1, n);
		amax(ans, GCD(left, right));
	}
	cout << ans << endl;
}


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int l=a+b,r=c+d;
  if(l>r) print("Left");
  else if(l<r) print("Right");
  else print("Balanced");
  
  return 0;
}

Measured memory_bytes: 256