akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
using namespace std;
 
int main() {
 
    int n;
    cin>>n;
    int a;
    int mx=0;
    int vis[8]={};
    for(int i=0;i<n;i++){
        cin>>a;
        if(a>=3200)
            mx++;
        else if(a>=1&&a<=399)
            vis[0]=1;
 
        else if(a>=400&&a<=799)
            vis[1]=1;
 
        else if(a>=800&&a<=1199)
            vis[2]=1;
 
        else if(a>=1200&&a<=1599)
            vis[3]=1;
 
        else if(a>=1600&&a<=1999)
            vis[4]=1;
 
        else if(a>=2000&&a<=2399)
            vis[5]=1;
 
        else if(a>=2400&&a<=2799)
            vis[6]=1;
 
        else if(a>=2800&&a<=3199)
            vis[7]=1;
 
    }
    int mn=0;
    for(int i=0;i<8;i++)
        mn+=vis[i];
    cout<<max(mn,1)<<' '<<mn+mx;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import kotlin.math.*
import java.util.*

data class Book(val c: Int, val a: List<Int>)

fun main(args: Array<String>) {
  val (n, m, x) = readLine()!!.split(' ').map(String::toInt)
  val books = Array(n) {
    val ca = readLine()!!.split(' ').map(String::toInt)
    Book(ca[0], ca.drop(1))
  }
  var ans = Int.MAX_VALUE
  repeat(2.0.pow(n).toInt()) { b ->
    var c = 0
    val sum = IntArray(m)
    for (i in 0 until n) {
      if (b and (1 shl i) == 0) continue
      c += books[i].c
      books[i].a.forEachIndexed { j, a -> sum[j] += a }
    }
    if (sum.all { x <= it }) {
      ans = min(ans, c)
    }
  }
  println(if (ans == Int.MAX_VALUE) -1 else ans)
}


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


def solve(A: int, B: int, C: int):
    print(max(0,B+C-A))


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

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  int n;
  cin >> n;
  vector<vector<int>> g(n, vector<int>(n));
  int u, k, v;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v;
      g[u - 1][v - 1] = 1;
    }
  }
  debug(g);
  string ans = "";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      ans += to_string(g[i][j]) + " ";
    }
    ans.pop_back();
    ans += "\n";
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3240
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
long long x, y, d;
	cin >> x >> y >> d;
    long long a;
    a = y / d;
	long long  b;
	b = (x == 0 ? -1 : (x - 1) / d);
	cout << a - b << endl;
	return 0;
}

Measured memory_bytes: 3196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String	strIn  = null;
		double	weight = 0.0;

		while ((strIn = parseStdin()) != null) {
			weight = Double.parseDouble(strIn);
			result(weight);
		}
	}

	private static void result(double weight) {
		String	strRank = "heavy";

		if (weight <= 48.0) {
			strRank = "light fly";
		}
		else if (weight <= 51.0) {
			strRank = "fly";
		}
		else if (weight <= 54.0) {
			strRank = "bantam";
		}
		else if (weight <= 57.0) {
			strRank = "feather";
		}
		else if (weight <= 60.0) {
			strRank = "light";
		}
		else if (weight <= 64.0) {
			strRank = "light welter";
		}
		else if (weight <= 69.0) {
			strRank = "welter";
		}
		else if (weight <= 75.0) {
			strRank = "light middle";
		}
		else if (weight <= 81.0) {
			strRank = "middle";
		}
		else if (weight <= 91.0) {
			strRank = "light heavy";
		}

		System.out.println(strRank);
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

Measured memory_bytes: 16912
#include<stdio.h>
int main(){
  int a, b, d, r;
  double f;
  scanf("%d %d", &a, &b);
  d = a/b;
  r = a%b;
  f = (double)a/(double)b;
  printf("%d %d %f\n", d, r, f);
  return 0;
}

Measured memory_bytes: 1852
#include <stdio.h>
int main()
{
  int i=0, l, p, q;
  int d[50];
  
  while(1)
    {
      for ( i = 0; i < 50; i++)
	{
	  d[i] = 0;
	} 
      scanf("%d %d", &l, &p);
      if( l == 0 && p == 0 ) break;
      q = p;
      while(1)
	{
	  if ( i >= l ) i = 0;
	  if ( p > 0 )
	    {
	      d[i] += 1;
	      p--;
	      if ( d[i] == q && p == 0)
		{
		  break;
		} 
	    }
	  else if ( p == 0 )
	    {
	      p = d[i];
	      d[i] = 0;
	    }
	  i++;
	}
      printf("%d\n", i);
    }
  return 0;
}

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

int main() {
  string takahashi;
  cin >> takahashi;
  if (takahashi.at(takahashi.size() - 1) == 's') {
    takahashi += "es";
  }
  else {
    takahashi += "s";
  }
  
 cout << takahashi << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;

vector<int> erat(int n) {
    vector<int> primes(n);
    for (int i = 2; i < n; ++i) primes[i] = i;
    for (int i = 2; i*i < n; ++i)
        if (primes[i])
            for (int j = i*i; j < n; j+=i) primes[j] = 0;
    // ?´???°?????????vector???????´?????????´????????\?????????????????? (0 ??§??????????´??????¨??????)
    primes.erase(remove(primes.begin(), primes.end(), 0), primes.end());
    return primes;
}

int main() {
	vector<int> v = erat(50000);
	int n;
	while(cin >> n) {
		if(n == 0) break;
		int ans = 0;
		rep(i,0,v.size()) {
			if(v[i] > n / 2) break;
			else if((n-v[i]) != 0 && *lower_bound(v.begin(), v.end(), n-v[i]) == n-v[i]) ans++;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1272
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scn = new Scanner(System.in)) {
			int N = scn.nextInt();
			long K = scn.nextLong();
			int[] A =  new int[N];
			int[] flg = new int[N];

			for(int i = 0; i < N; i++) {
				A[i] = scn.nextInt();
			}

			int cnt = 0;
			int next = 1;
			int prev = -1;
			for(int i = 0; i < K; i++) {
				flg[next-1]++;
				prev = next;
				next = A[next-1];
				cnt++;
				if(flg[next-1] == 2) {
					break;
				}
			}

			if(cnt == K) {
				System.out.println(next);
				System.exit(0);
			}
			//循環成立
			long tmp = 0;
			for(int i = 0; i < N; i++) {
				if (flg[i] == 2) tmp++;
			}

			long tmpK = (K - (long) cnt) % tmp;

			for(int i = 0; i < tmpK; i++) {
				flg[next-1]++;
				prev = next;
				next = A[next-1];
			}
			System.out.println(next);
		}
	}
}

Measured memory_bytes: 52116
h,w,k=map(int,input().split())
s=[input()for _ in range(h)]
ans=0
for ib in range(1<<h):
  for jb in range(1<<w):
    cc=0
    for i in range(h):
      if ib&(1<<i):continue
      for j in range(w):
        if jb&(1<<j):continue
        cc+=s[i][j]=="#"
    if cc==k:ans+=1
print(ans)

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

int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int count = 0;
  for(int a = 0;a<=A;a++) {
    for(int b = 0;b<=B;b++) {
      if(500*a+100*b<=X&&X<=500*a+100*b+50*C) {
        count++;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
n = int(input())
p = [int(i) for i in input().split()]
 
ans = 0
 
for i in range(n-2):
    if p[i] > p[i+1] > p[i+2]:
        ans += 1
    elif p[i] < p[i+1] < p[i+2]:
        ans += 1
 
print(ans)

Measured memory_bytes: 3060
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
int Q;long long x,y,z;
int main()
{
	scanf("%d",&Q);
	while(Q--)
	{
		scanf("%lld%lld",&x,&y);
		if(x>y)swap(x,y);
		z=int(sqrt(x*y));
		if(z*(z+1)<x*y)
			printf("%lld\n",2*z-1);
		else
		{
			if(z*z==x*y)
			{
				if(x==y)
					printf("%lld\n",2*z-2);
				else
					printf("%lld\n",2*z-3);
			}
			else
				printf("%lld\n",2*z-2);
		}
	}
}


Measured memory_bytes: 128
///
// File:  c.go
// Author: ymiyamoto
//
// Created on Fri Jun  8 00:02:13 2018
//
package main

import "fmt"

var N, L int
var a []int

func main() {
	fmt.Scan(&N, &L)
	a = make([]int, N)

	var valid bool
	var index int
	for i := range a {
		fmt.Scan(&a[i])

		if i-1 >= 0 && a[i-1]+a[i] >= L {
			valid = true
			index = i
		}
	}

	if valid {
		fmt.Println("Possible")
		for i := 1; i < index; i++ {
			fmt.Println(i)
		}
		for i := N - 1; i >= index; i-- {
			fmt.Println(i)
		}
	} else {
		fmt.Println("Impossible")
	}
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
#define EPS (1e-10)
#define rep(i,n) for(int i=0;i<(n);i++)
#define equals(a,b) (fabs((a) - (b)) < EPS)
#define ll long long
using namespace std;
typedef pair<int,int> P;
//const ll MOD = 1000000007;
//const ll INF = 100000000;

//const int max_n = 100000;
int n;
//vector<int> d(n);

//int ans = 0;

//stack<int> stack;
//queue<int> que;
//priority_queue<int> pque;
//set<int> s; set<int>::iterator ite;
//multiset<int> ms; multiset<int>::iterator ite;
//map<int, int> m; map<int, int>::iterator ite;
//multimap<int, int> mm; multimap<int, int>::iterator ite;

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

void solve() {
  int d;
  d = n % 10;
  if(d==3)printf("bon\n");
  else if(d==0 || d==1 || d==6 || d==8)printf("pon\n");
  else printf("hon\n");
  return;
}

int main(int argc, char const *argv[]) {

  cin >> n;

  /*rep(i,n) {
    int m;
    cin >> m;
    rep(j,m) {
      int a;
      cin >> a;
      d[a-1] = 1;
    }
  }*/

  solve();
  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
  bool is_prime[10001];
  fill(is_prime, &is_prime[10001], true);
  is_prime[0] = (is_prime[1] = false);
  
  for (int i = 2; i * i <= 10000; i++) {
    for (int j = i + i; j <= 10000; j += i) {
      is_prime[j] = false;
    }
  }
  
  int n;
  while (scanf("%d ", &n) == 1) {
    int c = 0;
    for (int i = 1; i <= n; i++) {
      if (is_prime[i] && is_prime[n - i + 1]) c++;
    }
    printf("%d\n", c);
  }
}

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

using namespace std;

int main()
{
	long long n, m;
	cin >> n >> m;
	cout << min(n, m / 2) + (n < m / 2 ? (m - 2 * n) / 4 : 0) << endl;

	return 0;
}


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define int long long int
const int MOD = 1000000007;
const int INF = 100100100;
const double EPS = 0.000000001;

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

bool pairCompare(const P& pair1, const P& pair2) {
    return pair1.second > pair2.second;
}

int gcd(int a, int b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A[100001];
  int lgcd[100001], rgcd[100001];
  cin >> N;
  REP(i, N){
    cin >> A[i];
    if(i == 0) lgcd[i] = A[i];
    lgcd[i+1] = gcd(lgcd[i], A[i]);
  }
  rgcd[0] = A[N-1];
  REP(i, N){
    rgcd[i+1] = gcd(rgcd[i], A[N-1-i]);
  }
  int ans = 0;
  REP(i, N){
    int temp;
    if(i == 0) temp = rgcd[N-1];
    else if(i == N-1) temp = lgcd[N-1];
    else temp = gcd(lgcd[i], rgcd[N-1-i]);
    if(ans < temp) ans = temp;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
int main(void){
    char word[1000][50]={{}},str[50]={};
    int i=0,j,s,index1,index2,len=0,count[1000]={};
    
    while(scanf("%s",str) != EOF){
        s=1;
        for(j=0;j<i;j++){
            if(strcmp(str,word[j]) == 0){
                count[j]++;
                s=0;
            }
        }
        
        if(s==1){
            strcpy(word[i],str);
            if(strlen(str)>len){
                len=strlen(str);
                index2=i;
            }
            i++;
        }
    }
    
    index1=0;
    for(j=0;j<i;j++){
        index1=(count[j]>count[index1]) ? j : index1;
    }
    
    printf("%s %s\n",word[index1],word[index2]);
    
    return 0;
}

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

int main(){
   int h,m,H,M,K,a,b;
   cin>>h>>m>>H>>M>>K;
   
   if(H==h){
       cout<<M-m-K<<endl;
   }
   if(H!=h){
       a=(H-h)*60+(M-m)-K;
       cout<<a<<endl;

   }
}

Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

ll c[27];
ll s[400][27];
ll last[27];
ll score[27];

int main(void){
	int D;
	cin>>D;
	for(int i=1;i<=26;i++)cin>>c[i];
	for(int i=1;i<=D;i++){
		for(int j=1;j<=26;j++){
			cin>>s[i][j];
		}
	}
	vector<ll>mx(D+1,0);
	for(int d=1;d<=D;d++){
		ll S = 0;
		for(int i=1;i<=26;i++){
			if(S<s[d][i]){
				mx[d]=i;
				S = s[d][i];
			}
		}
	}
	for(ll i=1;i<=D;i++)cout<<mx[i]<<endl;
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define int long long int
// #include"Template.cpp"

int n, l, q;
vector<int> arr;

vector<vector<int>> table;

void preprocess() {
    int curr = 1;
    int i = 1;
    while(i <= n) {
        if(curr == n+1) {
            table[i][0] = curr - 1;
            i ++;
            continue;
        }
        while(curr <= n && (arr[curr] - arr[i]) <= l) {
            curr ++;
        }
        table[i][0] = curr - 1;
        i ++;
    }
    for(int i = n; i > 0; i --) {
        for(int j = 1; j < 30; j ++) {
            int mid = table[i][j-1];
            if(mid != -1) {
                table[i][j] = table[mid][j-1];
            }
        }
    }
}

int query(int l, int r) {
    if(l > r) swap(l, r);
    int ans = 0;
    for(int j = 29; j >= 0; j --) {
        int pw = 1LL << j;
        if(table[l][j] == -1) continue;
        if(arr[table[l][j]] < arr[r]) {
            l = table[l][j];
            ans += pw;
        }
    }
    ++ans;
    return ans;
}

int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    arr.assign(n + 1, 0);
    table.assign(n+1, vector<int>(30, -1));
    for(int i = 1; i <= n; i ++) cin >> arr[i];
    cin >> l >> q;
    preprocess();
    // t(table);
    while(q --) {
        int low, high; cin >> low >> high;
        int ans = query(low, high);
        cout << ans << endl;
    }
    return 0;
}

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

signed main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif
  int n, a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d >> s;
  --a, --b, --c, --d;
  auto to = [&s](int id) {
    while (true) {
      int old = id;
      for (int d : {1, 2}) {
        if (id + d < (int) s.size() && s[id + d] == '.') {
          id += d;
        }
      }
      if (old == id) {
        break;
      }
    }
    return id;
  };
  if (to(a) < c || to(b) < d) {
    cout << "No\n";
  } else {
    if (c > d) {
      for (int i = b; i <= d; ++i) {
        if (i > 0 && i + 1 < (int) s.size() && s.substr(i - 1, 3) == "...") {
          cout << "Yes\n";
          return 0;
        }
      }
      cout << "No\n";
    } else {
      cout << "Yes\n";
    }
  }
}


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

int main() {
  string S, T;
  int a=0;
  cin >> S >> T;
  rep(i, S.size()){
    if(S==T){
      a=1;
      break;
    }
    S=S.at(S.size()-1)+S;
    S.pop_back();
  }
  if(a==1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import bisect
n, k = map(int, input().split())
a = list(map(int, input().split()))
negative_number_cnt = 0
positive_number_cnt = 0
negative_number = []
positive_number = []
zero_cnt = 0
a.sort()
def binary_search(left, right,positive):
    if right - left <= 1:
        return right
    middle = (right + left) // 2
    if is_can(middle,positive):
        return binary_search(left, middle,positive)
    else:
        return binary_search(middle, right,positive)
def is_can(x,positive):
    #xよりも小さい値がk個あるかどうか？
    if positive:
        count = than_less_zero
        #正＊正
        r = len(positive_number)-1
        for l in range(len(positive_number)):
            while l < r and positive_number[l] * positive_number[r] > x:
                r -= 1
            count += r - l
            if l >= r:
                break
        #負*負
        r = len(negative_number)-1
        for l in range(len(negative_number)):
            while l < r and r_negative_number[l] * r_negative_number[r] > x:
                r -= 1
            count += r - l
            if l >= r:
                break
        #print("target:{} count:{}".format(x,count))
        if count >= k:
            return True
        else:
            return False
    else:
        count = 0
        l,r = 0,0
        for l in range(len(negative_number)):
            while r < len(positive_number) and positive_number[r] * negative_number[l] > x:
                r += 1
            count += len(positive_number) - r
        if count >= k:
            return True
        else:
            return False



for i in range(n):
    if a[i] > 0:
        positive_number_cnt += 1
        positive_number.append(a[i])
    elif a[i] < 0:
        negative_number_cnt += 1
        negative_number.append(a[i])
    else:
        zero_cnt += 1
than_less_zero = ( negative_number_cnt * positive_number_cnt ) + (zero_cnt * (zero_cnt-1)//2) + zero_cnt * (n-zero_cnt)
r_negative_number = [negative_number[i] for i in range(len(negative_number)-1,-1,-1)]

if than_less_zero < k:
    #答えが正になる
    print(binary_search(0,10**20,True))
elif ( negative_number_cnt * positive_number_cnt ) < k:
    #答えが0になる
    print(0)
else:
    #答えが負になる
    print(binary_search(-10**20,5,False))


Measured memory_bytes: 96724
import std.stdio, std.string, std.conv;
import std.typecons;
import std.algorithm, std.array, std.range, std.container;
import std.math;

void main() {
	auto N = readln.split[0].to!int;
	auto data = readln.split, T = data[0].to!int, A = data[1].to!int;
	auto H = readln.split.to!(int[]);
	
	auto diff = N.iota.map!(n => (T.to!real - H[n].to!real*0.006 - A).abs );
	ulong result = 0;
	N.iota.each!(x => diff[x] < diff[result] ? result = x : 0);
	(1+result).writeln;
}

Measured memory_bytes: 380
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
using namespace std;


int main(){
	ll n, m; cin >> n >> m;
	vl ngo(m, 0);
	for (int i = 0; i < n; ++i){
		ll h; cin >> h;
		for (int j = 0; j < h; ++j){
			ll a; cin >> a;
			ngo[a - 1]++;
		}
	}ll ans = 0;
	for (int i = 0; i < m; ++i) if (ngo[i] == n) ans++;
	cout << ans << endl;
}

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

#define REP(n) for(int i = 0;i < n;i++)
using namespace std;

int main(){

    int a[12] = {1,3,1,2,1,2,1,1,2,1,2,1};
    int x,y;

    cin >> x >> y;
    if(a[x-1]==a[y-1]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }



    
   
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static void main(String[] args) throws IOException
	{
		//int nMax;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
		
		while(true)
		{
			String str = br.readLine();
			
			if(str.equals("0") ) break;
			
			char[] cArray = str.toCharArray();
			
			System.out.println(SumDigit(cArray) );
		}
	}
	
	static int SumDigit(char[] cArray)
	{
		int sum=0;
		int[] nArray = new int[cArray.length];
		
		for(int i=0; i<cArray.length; i++)
		{
			nArray[i] = Character.getNumericValue(cArray[i]);
			sum += nArray[i];
			
		}
		
		return sum;
	}
	
}

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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2){
        cout << "No\n";
        return 0;
    }
    string t="";
    for(int i=0;i<n/2;i++){
        t += s[i];
    }
    t = t+t;
    if(s==t){
        cout << "Yes\n";
        return 0;
    }
    cout << "No\n";

}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int r;
  cin >> r;
  cout << fixed << setprecision(15);
  cout << 2 * PI * r << "\n";    
  return 0;
}


Measured memory_bytes: 3776
H, W = map(int, input().split())
stage = []
for _ in range(H):
	stage.append(list(input()))

def count(y, x):
	directions = ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
	c = 0
	for d in directions:
		px, py = x + d[0], y + d[1]
		if px < 0 or W <= px or py < 0 or H <= py:
			continue
		if stage[py][px] == "#":
			c += 1
	return c

for y in range(H):
	for x in range(W):
		if stage[y][x] == ".":
			stage[y][x] = count(y, x)

for s in stage:
	print(*s, sep="")


Measured memory_bytes: 3444
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<bitset>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	string str;
	cin >> str;
	vector<int> arr(str.size());
	REP(i, str.size()){
		arr[i] = (int)str[i]- 48;
	}
	int maxbit = 1<<(str.size()-1);
	ll sum=0;
	for(int i=0; i<maxbit; i++){
		bitset<9> tmp(i);
		ll num=arr[0];
		for(int k=1; k<str.size(); k++){
			if(tmp[k-1]){
				sum += num;
				num = arr[k];
			}else{
				num = num*10 + arr[k];
			}
		}
		sum += num;
	}
	cout << sum << endl;
}


Measured memory_bytes: 3580
import 'dart:io';

void main() {
  List rgb = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  // if (rgb[2] % 2 == 1) {
  //   print("NO");
  // }
  int sum = rgb[0] * 100 + rgb[1] * 10 + rgb[2];
  if (sum % 4 == 0) {
    print("YES");
  } else {
    print("NO");
  }
}

Measured memory_bytes: 13060
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x;
    cin >> x;
    for(int i=x;i>=2;i--){
    	for(int j=2;j*j<=i;j++){
    		int m = i;
    		if(m%j==0){
    			while(m%j==0){
    				m=m/j;
    			}
    			if(m==1){
    				cout<<i<<endl;
    				return 0;
    			}
    			else{
    				continue;
    			}
    		}
    		else{
    			continue;
    		}
    	}
    }

    cout << 1 << endl;

    return 0;
}

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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);

    ll max1;
    rep(i, n)
    {
        cin >> a[i];
        if (i == 0)
        {
            max1 = a[i];
        }
        else
        {
            max1 = max(max1, a[i]);
        }
    }
    //10** 5となっているのでどうするかの問題はある。どう考えても絶対値が近いものが勝ち
    ll t; //絶対値の近さを格納
    ll u;
    rep(i, n)
    {
        if (a[i] == max1)
        {
            continue;
        }
        if (i == 0)
        {
            t = labs(a[i] - max1 / 2);
            u = a[i];
        }
        else
        {
            if (t > (ll)labs(a[i] - max1 / 2))
            {
                t = (ll)labs(a[i] - max1 / 2);
                u = a[i];
            }
        }
    }
    cout << max1 << " " << u;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
   //#ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  //#endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
  	cin>>arr[i];
  }
  int dp[n+1];
  memset(dp,INT_MAX,sizeof(dp));
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for(int i=2;i<n;i++)
  {
  	dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2]);
  }
  cout<<dp[n-1]<<endl;

}



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

int main() {
    string s, ans = "Heisei";
    cin >> s;
    int y = stoi(s.substr(0, 4));
    int m = stoi(s.substr(5, 2));
    int d = stoi(s.substr(8, 2));
    if (y > 2019) ans = "TBD";
    if (y == 2019 && m >= 5) ans = "TBD";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
int main(void){
    int n,m;
    while(cin>>n>>m,n){
        map<int,pii> mp;
        vi infect(20001,0);
        infect[1]=1;
        rep(i,m){
            int t,s,d;
            cin>>t>>s>>d;
            mp[t]=make_pair(s,d);
        }
        for(auto p:mp){
            infect[p.sc.sc]=infect[p.sc.sc] | infect[p.sc.fs];
        }
        cout<<accumulate(all(infect),0)<<endl;
    }
}

Measured memory_bytes: 4132
#include<iostream>
#include<algorithm>
#include<vector>
bool node[2010];
int N,K;
int ans=1<<30;
std::vector<int> G[2010];

void dfs(int n,int s,int &sum){
    node[n]=true;
    if(s==K/2){
        for(auto u:G[n]){
            if(!node[u])sum++;
        }
        return;
    }
    for(auto u:G[n]){
        if(!node[u])dfs(u,s+1,sum);
    }
}

int solve(int n){
    for(int i=1;i<=N;i++)node[i]=false;
    int M=0;
    node[n]=true;
    for(auto u:G[n]){
        int sum=0;
        dfs(u,1,sum);
        M=std::max(sum,M);
    }
    int sum=N;
    for(int i=1;i<=N;i++){
        if(node[i])sum--;
    }
    if(K%2)sum-=M;
    return sum;
}

int main(){
    std::cin>>N>>K;
    for(int i=1;i<N;i++){
        int A,B;
        std::cin>>A>>B;
        G[A].emplace_back(B);
        G[B].emplace_back(A);
    }
    for(int i=1;i<=N;i++){
        ans=std::min(ans,solve(i));
    }
    if(K==1)std::cout<<N-2<<std::endl;
    else std::cout<<ans<<std::endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		sc.close();
		for (int i = 0; i < S.length(); i++) {
			if (!(S.charAt(i) == T.charAt(i))) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 35744
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//CODE

void solve(void)
{
  string str;
  cin>>str;
  for (int i = 0; i < str.size(); i++)
  {
    if(i%2 == 0)
    {
      cout<<str[i];
    }
  }
  cout<<endl;
  
   
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rep1r(i, n) for (int i = ((int)(n)); i > 0; --i)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int cnt = 0;

int selectionSort(int a[], int n) {
    int minj = 0;
    rep(i, n) {
        minj = i;
        for (int j = i; j < n; j++) {
            if (a[j] < a[minj]) {
                minj = j;
            }
        }
        swap(a[i], a[minj]);
        if (a[i] != a[minj]) {
            cnt++;
        }
    }
    return 0;
}

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

    int n;
    cin >> n;
    int a[n];
    rep(i, n) { cin >> a[i]; }
    // check

    selectionSort(a, n);

    rep(i, n) {
        if (i > 0) cout << " ";
        cout << a[i];
    }
    cout << endl;
    cout << cnt << endl;

    return 0;
}



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

typedef long long int ll;
typedef vector<int> vi;            typedef vector<ll> vl;
typedef vector<vi> vvi;         typedef vector<vl> vvl;
typedef pair<int, int>     pii;    typedef pair<ll, ll> pll;
typedef vector<pii> vii;         typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define forne(i,n) for(int i=1;i<=n;i++)
#define rforne(i,n) for(int i=n;i>=1;i--)
#define forse(i,s,e) for(int i=s;i<e;i++)
#define rforse(i,s,e) for(int i=e-1;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
const ll INFL = 1e18;
const int INFI = 1e9;
const double pi = 3.14159265358979323846; 
#ifdef KARAN
    #include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}
ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
    while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

void solve(){
    double a, b, h, m;
    cin>>a>>b>>h>>m;
    double ang1 = m*6;
    double ang2 = h*30 + m*0.5;
    double diff = abs(ang1 - ang2);
    if(diff>180) diff = 360 - diff;
    diff = diff*pi/180;
    double c = a*a + b*b - 2*a*b*cos(diff);
    cout<<setprecision(15);
    cout<<sqrt(c)<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef KARAN
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        freopen("err.txt", "w", stderr);
    #endif
    int t=1;
    while(t--)
        solve();
}

Measured memory_bytes: 4248
#include<bits/stdc++.h>
using namespace std;
string B[110]={};
string R[110]={};
int M,N,money=0;
priority_queue<int> Q;
int main(){
  Q.push(0);
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> B[i];
  }
  cin >> M;
  for(int i=0;i<M;i++){
    cin >> R[i];
  }
  for(int i=0;i<N;i++){
    money=0;
    for(int j=0;j<N;j++){
      if(B[i]==B[j]) money++;
    }
    for(int j=0;j<M;j++){
      if(B[i]==R[j]) money--;
    }
    Q.push(money);
  }
  for(int i=0;i<M;i++){
    money=0;
    for(int j=0;j<N;j++){
      if(R[i]==B[j]) money++;
    }
    for(int j=0;j<M;j++){
      if(R[i]==R[j]) money--;
    }
    Q.push(money);
  }
  cout << Q.top() << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int A1, A2, A3;
	scanf("%d %d %d", &A1, &A2, &A3);
	
	A1+A2+A3 >= 22 ? printf("bust") : printf("win");
	
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define se second
#define fi first
#define pb push_back
const int N=1e5 + 5;
int v[N];
int n;

ll check(ll am){

	for(int i=0;i < n;i++){
		am-=am % v[i];
	}
	return am;
}

int main(){

//	freopen("in.txt","r",stdin);

	scanf("%d",&n);
	for(int i=0;i < n;i++){
		scanf("%d",v + i);
	}
	if(v[n - 1] != 2) return puts("-1"), 0;
	ll l=1,r=2e18 + 5,mn=2e18 + 10,mx=0;
	bool f=0;
	while(l <= r){
		ll mid=(l + r) / 2;
		ll temp=check(mid);
		if(temp >= 2){
			if(temp == 2) mn=min(mn,mid), f=1;
			r=mid - 1;
		}
		else l=mid + 1;
	}
	if(!f) return puts("-1"), 0;
	mx=mn;
	l=1, r=2e18 + 5;
	while(l <= r){
		ll mid=(l + r) / 2;
		ll temp=check(mid);
		if(temp <= 2){
			if(temp == 2) mx=max(mx,mid);
			l=mid + 1;
		}
		else r=mid - 1;
	}
	assert(mx % v[0] == v[0] - 1);
	cout << mn << " " << mx << endl;

}


Measured memory_bytes: 640
N = int(input())
ans = 0
for i in range(1, N+1):
    s = str(i)
    L = len(s)-2
    l = int(s[0])
    r = int(s[-1])
    if r == 0:
        continue
    if l > r:
        ans+=(10**(L+1)-1)//9*2
    elif l<r:
        ans+=(10**L-1)//9*2
    else:
        if L<0:
            ans+=1
        else:
            ans+=(10**L-1)//9*2+2
            ans+=((i-int(s[0]+'0'*L+s[-1]))//10+1)*2-1
print(ans)
            
        





Measured memory_bytes: 41580
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, a, b, sum;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0; i < N; i++){
        cin >> vec[i];
    }
    a = 0;
    sum = 1;
    for(int i = 0; i < N; i++){
        a = vec[a] - 1;
        if(a == 1){break;}
        sum ++;
        if(i == N - 1){
        sum = -1;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 640
#include <iostream>

using namespace std;

void f(int d) {
    if (d == 25) {
        cout << "Christmas" << endl;
    } else if (d == 24) {
        cout << "Christmas Eve" << endl;
    } else if (d == 23) {
        cout << "Christmas Eve Eve" << endl;
    } else if (d == 22) {
        cout << "Christmas Eve Eve Eve" << endl;
    }
}

int main() {

    int d;
    cin >> d;

    f(d);

    return 0;
}


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

int main(){
 int a,b;
  cin>>a>>b;
  if(a-b>0)
  for(int i=0;i<a;i++){
    cout<<b;
  }
  else 
    for(int i=0;i<b;i++){
      cout<<a;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	char n[200];
	int m,h,l,i,s;
	while(scanf("%s",n)!=EOF && strcmp(n,"-")){
		l=strlen(n);
		scanf("%d",&m);
		for(s=0;m;m--){
			scanf("%d",&h);
			s+=h;
		}
		s%=l;
		for(i=0;i<l;i++){
			printf("%c",n[(s+i)%l]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 568
import java.util.Scanner;
class Main{
    public static void main(String[] av){
	Scanner sc=new Scanner(System.in);
	int[] a=new int[3];
	a[0]=sc.nextInt();
	a[1]=sc.nextInt();
	a[2]=sc.nextInt();

	int[] b=new int[3];
	b[0]=a[0];
	for(int i=1;i<a.length;i++){
	    b[i]=a[i];
	    int j=i;
	    while(j>0){
	    if(b[j-1]>b[j]){
		int tmp=b[j-1];
		b[j-1]=b[j];
		b[j]=tmp;
	    }
		j--;
	    }
	}
	
	    System.out.println(b[0]+" "+b[1]+" "+b[2]);
	
    
    }
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl
#define DOUBLE(d) cout << fixed << setprecision(15) << (d) << endl

string S;

ll solve() {
    int sz = S.size();
    vi val(sz);
    int i = 0, v = 0;

    ll ret = 0;
    while (i < sz) {
        v = (v * 10 + (S[i] - '0')) % 2019;
        val[i] = v;
        if (v == 0) ret++;
        i++;
    }

    vi check(2019);
    int k = 1;
    REPR (i, sz) {
        check[(val[i] * k) % 2019]++;
        (k *= 10) %= 2019;
    }

    REP (i, 2019) ret += check[i] * (check[i]-1)/2;
    return ret;
}

int main() {
    cin >> S;
    cout << solve() << endl;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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

const ll MRINF = 5000000000000000;

int main() {

  ll N; cin >> N;
  string C; cin >> C;

  vector<ll> num(N,0);
  ll r = 0;

  if(C[0]=='R'){
    num[0]=1;
    r++;
  }
  else {
    num[0]=0;
  }
  REP(i, N-1){
    if(C[i+1]=='R'){
      num[i+1]=num[i]+1;
      r++;
    }
    else {
      num[i+1]=num[i];
    }
  }
  if(r==0)cout << 0 << endl;
  else cout << r - num[r-1] << endl;



}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 5180
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

#define forn(i,n) for(int i=0;i<n;i++)

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int h,w;
    cin>>h>>w;
    char x[h][w];
    
    forn(i,h){
        forn(j,w)   cin>>x[i][j];
    }
    
    bool col[w] = {false};
    bool row[h] = {false};

    forn(i,h){
        bool flag = true;
        forn(j,w){
            if(x[i][j]=='#'){
                flag= false;
                break;
            }
        }
        if(flag){
            //cout<<"---\n";
            //cout<<i<<endl;
            row[i] = true;
        }
    }

    forn(j,w){
        bool flag = true;
        forn(i,h){
            if(x[i][j]=='#'){
                flag = false;
                break;
            }
        }
        if(flag){
            //cout<<"---\n";
            //cout<<j<<endl;
            col[j] = true;
        }
    }
   /* 
    cout<<"The columns are\n";
    forn(i,w)   cout<<i<<" "<<col[i]<<endl;
    cout<<"The rows are\n";
    forn(i,h)   cout<<i<<" "<<row[i]<<endl;
*/
    forn(i,h){
        forn(j,w){
            if(row[i] && col[j]){
                break;
            }
            if(row[i] || col[j]){
                if(j==w-1) cout<<"\n";
                continue;
            }    
            cout<<x[i][j];
            if(j==w-1)  cout<<"\n";
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
//ONLINE_JUDGE   LOCAL
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef LOCAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}
 


 
int main(){
//	in_o();
	int64 a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k%2==0)
		cout<<a-b<<endl;
	else
		cout<<b-a<<endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

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

  int n = 3;
  vector<int> a(n);
  for (int i = 0; i < n; ++i)
  {
  	cin >> a[i];
  }

  sort(a.begin(), a.end());
  cout << a[2] - a[0] << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()

ans = 0
for i in range(A, B+1):
	if str(i) == str(i)[::-1]:
		ans += 1

print(ans)


Measured memory_bytes: 5208