akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
#define FOR(i,a,b) for(ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1000000007;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
int main(){
  ll n,k;
  cin >> n >> k;
  vl h(n);
  REP(i,n) cin >> h[i];
  sort(ALL(h));
  ll ans = MOD,sum;
  FOR(i,k-1,n){
    sum = h[i] - h[i-k+1];
    ans = min(ans,sum);
  }
  cout << ans << endl;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using P = pair <int,int>; //to, cost
using WeightedGraph = vector<vector <P>>; //to cost
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
template <typename t>
int digit(t x){
    int cnt = 0;
    while(x){
        x/=10;
        cnt++;
    }
    return cnt;
}
signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; cin>>n;
    int ans = digit(n);
    for(int i=1;i*i<=n;i++){
        if(n % i==0){
            int x = digit(i);
            int y = digit(n/i);
            int tmp = max(x, y);
            chmin(ans, tmp);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
from operator import itemgetter

n, k = map(int, input().split(" "))
sushis = [list(map(int, input().split(" "))) for i in range(n)]
flags = [False for i in range(n+10)]

# calc score
sushis = sorted(sushis, key=itemgetter(1), reverse=True)
duplicated_set = []
variety = 0
eat = 0
max_score = 0
sum1 = 0
for i, sushi in enumerate(sushis):
    t, d = sushi
    if eat < k:
        sum1 += d
        eat += 1
        if flags[t]:
            duplicated_set.append(d)
        else:
            variety += 1
            flags[t] = True
        if eat == k:
            sum1 += variety * variety
            max_score = sum1
            duplicated_set = sorted(duplicated_set, reverse=True)
    else:
        if variety == k or len(duplicated_set) == 0:
            break
        if flags[t]:
            pass
        else:
            variety += 1
            flags[t] = True
            sum1 = sum1 + d - duplicated_set.pop() + 2*(variety) - 1
            max_score = max(max_score, sum1)

print(max_score)


Measured memory_bytes: 32716
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> dp(n, 0);
    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);

    for (int i=2; i<n; i++)
        dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));

    cout << dp[n-1] << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		String n[] = new String[N];
		int AC = 0;
		int WA = 0;
		int TLE = 0;
		int RE = 0;
		
		for(int i=0; i<N; i++) {
			n[i] = scan.next();
			if(n[i].equals("AC")) {
				AC++;
			}else if(n[i].equals("WA")){
				WA++;
			}else if(n[i].equals("TLE")){
				TLE++;
			}else if(n[i].equals("RE")){
				RE++;
			}
		}
		System.out.println("AC x "+AC);
		System.out.println("WA x "+WA);
		System.out.println("TLE x "+TLE);
		System.out.println("RE x "+RE);
	}
}

Measured memory_bytes: 65256
// https://atcoder.jp/contests/abc179/tasks/abc179_e

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
template <typename T>
using VV = V<V<T>>;
using VVL = VV<ll>;
template <typename T>
using VVV = VV<V<T>>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
using asc_pq = priority_queue<T, V<T>, greater<T>>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

const int MAX_BIT = 33;  // 10^10 < 2^34 - 1

int val[MAX_BIT + 1][100005];  // val[bit][num]: num から 2^bit 操作した値
ll sum[MAX_BIT + 1][100005];  // sum[bit][num]: num から 2^bit 操作した総和

void solve() {
  ll N, X, M;
  cin >> N >> X >> M;

  fill(&val[0][0], &val[0][0] + sizeof(val) / sizeof(val[0][0]), 0);
  fill(&sum[0][0], &sum[0][0] + sizeof(sum) / sizeof(sum[0][0]), 0);

  rep(num, M) {
    val[0][num] = num * num % M;
    sum[0][num] = num;
  }

  rep(bit, MAX_BIT) {
    rep(num, M) {
      val[bit + 1][num] = val[bit][val[bit][num]];

      ll added;
      if (!__builtin_add_overflow(sum[bit][num], sum[bit][val[bit][num]],
                                  &added)) {
        sum[bit + 1][num] = added;
      }
    }
  }

  ll cur = X;
  ll res = 0;

  repr(bit, MAX_BIT + 1) {
    if (N & (1ll << bit)) {
      res += sum[bit][cur];
      cur = val[bit][cur];
    }
  }

  cout << res << "\n";
}


Measured memory_bytes: 43448
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> as(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> as[i];
    vector<int> bs(n + 1, 0), cs;
    for (int i = n; i >= 1; i--)
    {
        int sum = as[i];
        for (int j = i + i; j <= n; j += i)
            sum += bs[j];
        bs[i] = sum % 2;
        if (bs[i])
            cs.emplace_back(i);
    }

    int m = cs.size();
    cout << m << endl;
    for (int i = 0; i < m; i++)cout << cs[i] << ' ';
    return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    ll ar[n];
    ll maxN=1000005;
    vector<int> freq(1000001,0);
    for(int x=0;x<n;x++){
        cin>>ar[x];
        freq[ar[x]]++;
    }
    sort(ar,ar+n);
    vector<bool> sieve(maxN+1,true);
    ll count=0;
    for(ll x=1;x<maxN;x++){
        if(freq[x] && sieve[x]){
            for(ll y=2*x;y<=maxN;y+=x){
                sieve[y]=0;
            }
            if(freq[x]==1){
                count++;
            }
        }
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 9056
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define int int64_t
#define watch(x) cout << (#x) << " is " << (x) << endl

const int32_t MAX=1e9+7;
typedef vector<int> vi;
typedef vector<int64_t> vll;


int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
	
	int ans{0};
	for(int i=1;i<=5;i++){
		int temp;
		cin >> temp;
		if(temp==0)
			ans=i;
	}
	cout << ans;
    return 0;
}



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

int main() {
  int N,M,k;
  string kari;
  vector<string> a;
  vector<string> b;
  vector<int> a_count(1,1);
  
  cin >> N;
  cin >> kari;
  a.push_back(kari);
  for(int i=1;i<N;i++){
    cin >> kari;
    k=a.size();
    bool isNew=true;
    for(int j=0;j<k;j++){
      if(a.at(j)==kari){
        a_count.at(j)++;
        isNew=false;
        break;
      }
    }
    if(isNew){
      a.push_back(kari);
      a_count.push_back(1);
    }
  }
  vector<int> b_count(a.size(),0);
  cin >> M;
  for(int i=0;i<M;i++){
    cin >> kari;
    for(int j=0;j<a.size();j++){
      if(a.at(j)==kari){
        b_count.at(j)++;
        break;
      }
    }
  }
  k=0;
  for(int i=0;i<a_count.size();i++){
    k=max(k,max(a_count.at(i)-b_count.at(i),0));
  }
  cout << k << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
	ll x;
	cin>>x;
	for(ll i=-1000;i<=1000;i++){
	    for(ll j=-1000;j<=1000;j++){
	 	    if(pow(i,5)-pow(j,5)==x){
                cout<<i<<' '<<j<<'\n';
                return 0;
            }
	    }   
    }
}

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

int main()
{
	int i, n, ans;
	cin >> n;
	string s;
	cin >> s;
	ans=1;
	char c;
	c=s[0];
	for(i=1; i<n; i+=1)
	{
		if(c!=s[i])
		{
			ans+=1;
			c=s[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int count=0;
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

        for(int i=a; i<=b; i++){
            if(c%i==0) count++;
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 26348
#!/usr/bin/env python
import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def main():
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())
    #ps = list(map(int, input().split()))

    N, W = map(int, input().split())

    dp = [defaultdict(int)]
    dp[0][0] = 0
    for i in range(N):
        w, v = map(int, input().split())
        keys = sorted(list(dp[i].keys()))
        new_dp = defaultdict(int)
        for key in keys:
            new_dp[key] = max([new_dp[key], dp[i][key]])
            new_w = key + w
            if new_w <= W:
                new_dp[new_w] = max([new_dp[new_w], dp[i][key] + v])

        max_value = 0
        for key in sorted(new_dp.keys()):
            if max_value > new_dp[key]:
                del new_dp[key]
            else:
                max_value = new_dp[key]

        dp.append(new_dp)
    print(max(dp[N].values()))


if __name__ == '__main__':
    main()


Measured memory_bytes: 80748
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| iterator.next().unwrap().parse().unwrap())
        .collect();

    let ans: usize = gcd(&a);

    return ans.to_string();
}

fn gcd(vec: &Vec<usize>) -> usize {
    if vec.len() < 2 {
        panic!();
    }
    let mut result = vec[0];
    for i in 1..vec.len() {
        result = _gcd(result, vec[i]);
    }
    result
}

fn _gcd(m: usize, n: usize) -> usize {
    if n > m {
        return _gcd(n, m);
    }
    if n == 0 {
        return m;
    }
    return _gcd(n, m % n);
}


Measured memory_bytes: 6396
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cctype>
#include<string>
#include<cmath>
using namespace std;

int main(){
    double x1, y1, x2, y2;
    double answer;

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

    // cout << x1 << endl;
    // cout << y1 << endl;
    // cout << x2 << endl;
    // cout << y2 << endl;

    // cout << pow((x1 - x2), 2) << endl;
    // cout << pow((y1 - y2), 2) << endl;

    // cout << sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2)) << endl;

    answer = sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
    printf("%lf\n", answer);

    return 0;
}


Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

const ll MAX_N = 2e5+5;
const ll D = 60;
// to[v][i] .. 2^i from v.
int to[MAX_N][D];

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, k;
  cin >> n >> k;

  rep(i,n) {
    cin >> to[i][0];
    --to[i][0];
  }
  rep(i,D-1)rep(v,n) {
    to[v][i+1] = to[to[v][i]][i];
  }

  int v = 0;
  for (int i = D-1; i >= 0; --i) {
    ll l = 1ll<<i;
    if (k&l) {
      v = to[v][i];
      k -= l;
    }
  }
  cout << v+1 << endl;
}


Measured memory_bytes: 50432
/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();

    int n = Integer.parseInt(br.readLine());
    long[] arr = new long[n];
    for (int i=0; i<n; i++) {
      arr[i] = Integer.parseInt(br.readLine());
      if (arr[i]>i || (i>0 && arr[i]>arr[i-1]+1)) {
        System.out.println("-1");
        return;
      }
    }
    long sum = 0;
    int prevPos = -1;
    long prevVal = -1;
    for (int i=n-1; i>=0; i--) {
      if (prevPos>=0 && arr[i]==prevVal-(prevPos-i)) {
        sum += 0;
      } else {
        sum += arr[i];
        prevPos = i;
        prevVal = arr[i];
      }
    }
    System.out.println(sum);
  }
}


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

using namespace std;

vector<long> lengths(51);
vector<long> pates(51);

long burger(long level, long length){
    if(level == 0){
        if(length <= 0)return 0;
        else return 1;
    }
    else if(length <= 1 + lengths.at(level-1)){
        return burger(level-1, length-1);
    }
    else{
        return pates.at(level-1) + 1 + burger(level-1, length-lengths.at(level-1)-2);
    }
}

int main(){

    long n,x;
    cin >> n >> x;

    lengths.at(0) = 1;
    pates.at(0) = 1;
    for(int i=1;i<=50;i++){
        lengths.at(i) = lengths.at(i-1) * 2 + 3;
        pates.at(i) = pates.at(i-1) * 2 + 1;
    }

    cout << burger(n, x) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;  
    cin>>a>>b;
    if(a[0]==b[2]&&a[1]==b[1]&&a[2]==b[0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
// #define DEBUG_MODE
#ifdef DEBUG_MODE
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(x) fprintf(stderr, "[%s = %d]\n", #x, x)
#else
	#define errp(...)
	#define dbg(x) 
#endif

const int N = 100010;
int n, m, a[N];

int main () { 
#ifdef DEBUG_MODE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	int l, r;
	memset(a, 0, sizeof a);
	for (int i = 0; i < m; i++) {
		scanf("%d%d", &l, &r);
		a[l]++; 
		a[r + 1]--;
	}
	for (int i = 1; i <= n; i++) a[i] += a[i - 1];
	int ans = 0;
	for (int i = 1; i <= n; i++) if (a[i] == m) ans++;
	printf("%d\n", ans);
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#define M 1000000
#define L 14
#define FIND 1
#define Notfind 0

char H[M][L]; /* Hash Table */

int getChar(char);
long long getKey(char *);
int h1(int);
int h2(int);
int find(char *);
int insert(char *);

int main()
{
    int i,j=0,n,h,cnt=0;
    int pr[M/2];
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0'; //空白文字を入れておく
    
    scanf("%d", &n);
    
    for (i=0;i<n;i++)
    {
	scanf("%s%s",com,str);
	
	if (com[0]=='i')
    {
	    insert(str);
	}
    else
    {
	    if(find(str))
        {
		pr[j]=1; cnt++; j++;
	    }
        else
        {
		pr[j]=0; cnt++; j++;
	    }
	}
    }
    for(j=0;j<cnt;j++)
    {
        if(pr[j]==1) printf("yes\n");
        if(pr[j]==0) printf("no\n");
    }
    return 0;
}

int h1(int key){ return key%M; }           //ここの二つのh1 h2が肝
int h2(int key){ return 1 + (key%(M-1)); }

int insert(char *str)
{
    long long key;
    int h,i;
    
    key=getKey(str);
    for(i=0;;i++)
    {
    h=(h1(key)+i*h2(key))%M;

    if(strcmp(H[h],str)==0)  //入っている文字列が同じだった場合は入れなくていいのでreturnする。
    {
        return 1;
    }

    if(strlen(H[h])==0) //何も入っていなかった場合
    {
    strcpy(H[h],str);
    return 0;
    }
    } 
    return 0;
}

int find(char *str)
{
    int i;
    int key,h;
    key=getKey(str);
    for(i=0;;i++)
    {
    h=(h1(key)+i*h2(key))%M;

    if(strcmp(H[h],str)==0)  
    {
        return FIND;
    }
    else if(strlen(H[h])==0) return Notfind;
    }
    return 0;
}

/*ここで文字を数字に変換*/
int getChar(char ch)
{
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  return 0;
}

/*文字列を整数値に変換した合計(keyを入手)*/
long long getKey(char *str){
  long long key = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    key += p*(getChar(str[i]));
    p *= 5;
  }
  return key;
}


Measured memory_bytes: 17096
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
 
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}
 
long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int k;
  cin>>k;
  long long a[k + 1];
  REPP(i, k) cin>>a[i];
  long long l[k + 1], r[k + 1];
  l[k] = r[k] = 2;
  for(int i = k; i >= 1; i--){
    long long x = (l[i] + a[i] - 1)/a[i] * a[i];
    long long y = r[i]/a[i] * a[i];
    if(x > y){
      cout << -1 << endl;
      return 0;
    }
    l[i-1] = x;
    r[i-1] = y + a[i] - 1;
  }
  cout << l[0] << ' ' << r[0] << endl; 
  return 0;
}


Measured memory_bytes: 5976
#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 >= 1; 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 SORT(v, n) stable_sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#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; }

static const int MAX = 100;
static const ll  INF = (1LL << 32);

int n;
ll  d[MAX][MAX];

void floyd() {
    rep(k, n) {
        rep(i, n) {
            if (d[i][k] == INF) continue;
            rep(j, n) {
                if (d[k][j] == INF) continue;
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

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

    int e, u, v, c;
    cin >> n >> e;

    rep(i, n) {
        rep(j, n) { d[i][j] = ((i == j) ? 0 : INF); }
    }
    rep(i, e) {
        cin >> u >> v >> c;
        d[u][v] = c;
    }

    floyd();

    bool negative                       = false;
    rep(i, n) if (d[i][i] < 0) negative = true;

    if (negative) {
        cout << "NEGATIVE CYCLE" << endl;
    } else {
        rep(i, n) {
            rep(j, n) {
                if (j) cout << " ";
                if (d[i][j] == INF)
                    cout << "INF";
                else
                    cout << d[i][j];
            }
            cout << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 3268
#include <stdio.h>
int min(int x,int y){
    if(x<y) return x;
    else return y;
}
int main(void){
    int n,k,i,ans=0;
    scanf("%d%d",&n,&k);
    int a[n];
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(i=0;i<n;i++){
        int tmp=min(a[i],k-a[i]);
        ans+=tmp;
    }
    printf("%d",ans*2);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define INF (1 << 30) - 1
 
int main(){
  ll n, T;
  cin >> n >> T;
 
  vector<ll> b;
  vector<P> a_b;
  for(int i = 0; i < n; ++i){
    ll a_, b_;
    cin >> a_ >> b_;
    if(a_ == 0)b.push_back(b_ + 1);
    else a_b.push_back(P(a_, b_));
  }
 
  sort(a_b.begin(), a_b.end(), [](P p, P q){
    return p.first * (q.second + 1) > q.first * (p.second + 1);
  });
  sort(b.begin(), b.end());

  vector<ll> dp(33, INF);
  dp[0] = 0;
  for(auto p : a_b){
    ll a = p.first;
    ll b = p.second;
    for(int i = 32; i > 0; --i){
      if(dp[i - 1] > T)continue;
      dp[i] = min(dp[i], (a + 1) * dp[i - 1] + a + b + 1);
    }
  }
 
  ll count = 0;
  for(int i = 32; i >= 0; --i){
    ll cur = dp[i];
    if(cur > T)continue;
    ll tmp_count = i;
    for(int j = 0; j < b.size(); ++j){
      if(cur + b[j] > T)break;
      cur += b[j];
      ++tmp_count;
    }
    if(count < tmp_count){
      count = tmp_count;
    }
  }
 
  cout << count << endl;
 
  return 0;
}

Measured memory_bytes: 6256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>
#include <set>

const int INT_INF = 1e9;
const long long LONG_INF = 1e18;
const long long MOD = 1e9 + 7;

using namespace std;

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

    if (s == "ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }

    return 0;
}

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

const int MOD = 1e9 + 7;

long long powmod(long long x, long long k, long long m = MOD){ // 繰り返し二乗法(logk)
	if (k < 0) return 0;
	if(k == 0) return 1;
	if(k % 2 == 0) return powmod(x * x % m, k / 2, m);
	else return x * powmod(x, k - 1, m) % m;
}

int main(int argc, char const *argv[])
{
	string s; cin >> s;
	int n = s.size();
	vector<int> sum(4, 0);
	for(auto u : s) {
		if (u == '?') sum[3]++;
		else sum[u - 'A']++;
	}

	vector<int> cnt(4, 0);
	ll ans = 0;
	for (auto u : s) {
		ll la = 0, lq = 0, rc = 0, rq = 0;
		if (u == 'B') {
			la = cnt[0], lq = cnt[3];
			rc = sum[2] - cnt[2], rq = sum[3] - cnt[3];
			cnt[1]++;
		} else if (u == '?') {
			la = cnt[0], lq = cnt[3];
			rc = sum[2] - cnt[2], rq = sum[3] - cnt[3] - 1;
			cnt[3]++;
		} else {
			cnt[u - 'A']++;
			continue;
		}

		// printf("%lld %lld %lld %lld\n", la, lq, rc, rq);
		ans += (la * powmod(3, lq) % MOD) * ((rc * powmod(3, rq) % MOD) + (rq * powmod(3, rq - 1) % MOD));
		ans %= MOD;
		ans += (lq * powmod(3, lq - 1) % MOD) * ((rc * powmod(3, rq) % MOD) + (rq * powmod(3, rq - 1) % MOD));
		ans %= MOD;

		// printf("ans %lld\n", ans);
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
  int l,n;
  cin >> n >> l;
  
  vector<string> s(n);
  for(int i=0; i<n; i++){
    cin >> s[i];
  }
  
  sort(s.begin(),s.end());
  
  for(int i=0; i<n; i++) cout << s[i];
  cout <<endl;
}

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

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

    int n,k;
    cin >> n >> k;
    int a[n];
    int idx1;
    rep(i,n){
        cin >> a[i];
        if(a[i] == 1) idx1 = i;
    }
    
    int left = idx1 / (k - 1);
    int right = (n - idx1 - 1) / (k - 1);
    int left_mod = idx1 % (k - 1);
    int right_mod = (n - idx1 - 1) % (k - 1);
    int center = (left_mod==0 && right_mod==0)? 0 : (left_mod + right_mod + 1) / k;
    int mod = (left_mod==0 && right_mod==0)? 0 : (((left_mod + right_mod + 1) % k >= 1)? 1 : 0);
    
    cout << left + right + center + mod << endl;
    
    return 0;
}

Measured memory_bytes: 640
use std::io::{self, Read, Write};

#[rustfmt::skip] #[macro_use] #[allow(unused_macros)]
mod rwc {
    macro_rules! rd { ($buf:ident, $t:ty)       => { $buf.next().unwrap().parse::<$t>().ok().unwrap() }; }
    macro_rules! wt { ($out:ident, $($arg:tt)*) => { write!($out, $($arg)*).ok()                      }; }
    macro_rules! cv { ($n:expr, $fn:expr)       => { (0..$n).map($fn).collect::<Vec<_>>()             }; }
}

fn main() {
    let (mut _buf, mut _out) = (String::new(), io::stdout());
    let (mut _buf, mut _out) = {
        io::stdin().read_to_string(&mut _buf).ok();
        (_buf.split_whitespace(), io::BufWriter::new(_out.lock()))
    };

    let r = rd!(_buf, f64);
    wt!(_out, "{:.10}\n", 2.0 * 3.1415 * r);
}


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

int main() {
  int N,L;
  priority_queue<string, vector<string>,greater<string>> pq;
  cin >> N >> L;
  for(int i=0;i<N;++i){
    string S; cin >> S;
    pq.push(S);
  }

  while(!pq.empty()){
    cout << pq.top();
    pq.pop();
  }
  cout << endl;
  return 0;
}


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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

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

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

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); }
// }}}

void solver() {
    string s;
    cin >> s;

    if (s[1] == 'B') {
        cout << "ARC" << endl;
    } else {
        cout << "ABC" << endl;
    }
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
int main(){
	cin>>n;
	if(n%10 == n/100)
		printf("Yes\n");
	else
		printf("No\n");
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
     long long int N,x,a[100000] ;
     cin >> N >> x ;
     for(int i=0;i<N;i++){
          cin >> a[i] ;
     }
     long long int count = 0 ; 
     for(int i=0;i<N-1;i++){
          if(a[i]+a[i+1]>x){
               count += a[i]+a[i+1]-x ;
               if(x>=a[i]){
                    a[i+1] = x-a[i]  ;
               }else{
                    a[i+1] = 0 ;
                    a[i] = x ; 
               }
          }
     }
     cout << count ;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
 
long long Length(int l){
  if(l == 0) return 1;

  long long x = Length(l-1);
  return 3 + 2*x;
}

long long P(int l){
  if(l == 0) return 1;

  return 1 + 2*P(l-1);
}
int main(){
  long long n, x, ans=0;

  cin >> n >> x;

  long long l = n; 
  while(x > 0 && l > 0){
    if(x >= (Length(l) + 1) / 2){
      x -= (Length(l) + 1) / 2;
      ans += P(l-1) + 1;
    }else{
      --x;
    }
    --l;

    if(l == 0 && x > 0) ++ans;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
ans=1
for i in range(n-1):
    ans+=(n-i)*(n-i+1)//2
    u,v=map(int,input().split())
    if v<u:
        u,v=v,u
    ans-=u*(n+1-v)
print(ans)

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

int main(){

  int N, A, R ;
  /*N:支払金額
    A:持っている1円硬貨
    R:500円硬貨で支払った後の余り*/
  cin >> N >> A;

  R = N % 500;
  if(A >= R){
    cout << "Yes";
  }else if( A < R){
    cout << "No";
  }

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        if(n%k == 0)System.out.println(0);
        else System.out.println(1);
    }
}

Measured memory_bytes: 21844
#入力取得
N, M = map(int, input().split())

#最大と最小を選べば良い

left_max = 0
right_min = N


for i in range(M):

    tmp_left,tmp_right = map(int, input().split())


    if tmp_left > left_max:
        left_max = tmp_left

    if tmp_right < right_min:
        right_min = tmp_right



result = right_min - left_max

if result < 0:
    print(0)
else:
    print(result + 1)


Measured memory_bytes: 3060
a,b,c,d = map(int, input().split())
from functools import reduce
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve(tmp,c,d):
    num=lcm(c,d)
    ans = tmp//c + tmp//d - tmp//num
    return tmp-ans

print(solve(b,c,d) -solve(a-1,c,d))

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

#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back

int main()
{
    vector<int> f(3);
    cin >> f[0] >> f[1] >> f[2];
    sort(f.begin(), f.end());
    cout << f[0] + f[1] << endl;

    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int f[101][100001];
int n,m;
int a[101];
int s[100001];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	f[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		f[i][0]=1;
		s[0]=1;
		for(int j=1;j<=m;j++)
			s[j]=((long long)s[j-1]+f[i-1][j])%1000000007;
		for(int j=1;j<=m;j++)
		{
			if(a[i]>=j)
				f[i][j]=s[j];
			else
				f[i][j]=((long long)s[j]-s[j-a[i]-1]+1000000007)%1000000007;
		}
	}
	printf("%d",f[n][m]);
}

Measured memory_bytes: 39680
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = 0;
		int b = 0;
		int c, d, e;
		while(sc.hasNext()){
			String[] s = sc.next().split(",");
			c = Integer.valueOf(s[0]);
			d = Integer.valueOf(s[1]);
			e = Integer.valueOf(s[2]);
			if(c*c + d*d == e*e)a++;
			if(c==d)b++;
		}
		System.out.println(a);
		System.out.println(b);
	}	
}

Measured memory_bytes: 17132
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <cassert>
#include <cmath>
using namespace std;

int main() {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        puts(a <= c && c <= a + b ? "YES" : "NO");
        return 0;
}



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

long long ans;
int a[1000005];
string s;

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

    cin >> s;

    for (int i = 1; i <= s.size(); i++) {
    	a[i] = s[i-1] - '0';
    }

    for (int i = s.size(); i >= 0; i--) {
    	if (a[i] < 5) {
    		ans += a[i];
    	}
    	else if (a[i] > 5) {
    		ans += (10 - a[i]);
    		a[i-1]++;
    	}
    	else if (a[i] == 5) {
    		if (a[i-1] >= 5) {
    			ans += (10 - a[i]);
    			a[i-1]++;
    		}
    		else {
    			ans += a[i];
    		}
    	}
    }

    cout << ans << '\n';
 
    return 0;
}

Measured memory_bytes: 5276
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int z(int x){
  return (x-1)-(x-1)%10+10;
}
int main(){
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  int m=min((a-1)%10,min((b-1)%10,min((c-1)%10,min((d-1)%10,(e-1)%10))))+1;  
  cout<<z(a)+z(b)+z(c)+z(d)+z(e)-10+m<<endl;
  
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i,j,n,u,v,k;
  scanf("%d",&n);
  int a[n][n];
  for(i=0;i<n;i++)
    for(j=0;j<n;j++)a[i][j]=0;

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      a[i][v-1]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j!=0) printf(" %d",a[i][j]);
      else     printf("%d",a[i][j]);
    }
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define com(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define pri(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<endl;
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
/*__builtin_clz();
__builtin_ctz();
__builtin_popcount();*/
int main()
{
    ll a,b;
    cin>>a>>b;
    string s;
    ll x= min(a,b);
    ll y = max(a,b);
    for(ll i=0;i<y;i++)
    {
        s+=x+'0';
    }
    
    cout<<s<<"\n";
    cerr << "\nTime elapsed: " << 1000 * clock()/CLOCKS_PER_SEC << "ms\n";
}





// bool prime[100000];

// // int gcdExtended(int a, int b, int *x, int *y) ;
// ll modInverse(int a, int m) 
// { 
//     int x, y; 
//     int g = gcdExtended(a, m, &x, &y); 
//     // if (g != 1) 
//     //     cout << "Inverse doesn't exist"; 
//     // else
//     // { 
//         // m is added to handle negative x 
//         int res = (x%m + m) % m; 
//         return res; 
//     // } 
// } 
  
// // // C function for extended Euclidean Algorithm 
// int gcdExtended(int a, int b, int *x, int *y) 
// { 
//     // Base Case 
//     if (a == 0) 
//     { 
//         *x = 0, *y = 1; 
//         return b; 
//     } 
  
//     int x1, y1; // To store results of recursive call 
//     int gcd = gcdExtended(b%a, a, &x1, &y1); 
  
//     // Update x and y using results of recursive 
//     // call 
//     *x = y1 - (b/a) * x1; 
//     *y = x1; 
  
//     return gcd; 
// } 
// ll modu(ll x)
// {
//     if(x<0)
//     {
//         x+=mod;
//     }
//     else 
//     {
//         x=x%mod;
//     }
//     return x;
// }

// void SieveOfEratosthenes(int n) 
// { 
//     // Create a boolean aay "prime[0..n]" and initialize 
//     // all entries it as true. A value in prime[i] will 
//     // finally be false if i is Not a prime, else true. 
     
//     memset(prime, true, sizeof(prime)); 
  
//     for (int p=2; p*p<=n; p++) 
//     { 
//         // If prime[p] is not changed, then it is a prime 
//         if (prime[p] == true) 
//         { 
//             // Update all multiples of p greater than or  
//             // equal to the square of it 
//             // numbers which are multiple of p and are 
//             // less than p^2 are already been marked.  
//             for (int i=p*p; i<=n; i += p) 
//                 prime[i] = false; 
//         } 
//     } 
//     prime[1]=false;
  
//     // Print all prime numbers 
//     // for (int p=2; p<=n; p++) 
//     //    if (prime[p]) 
//     //       cout << p << " "; 
// } 
// ll power(ll x, unsigned ll y, ll p) 
// { 
//     ll res = 1;      // Initialize result 
  
//     x = x % p;  // Update x if it is more than or  
//                 // equal to p 
  
//     while (y > 0) 
//     { 
//         // If y is odd, multiply x with result 
//         if (y & 1) 
//             res = (res*x) % p; 
  
//         // y must be even now 
//         y = y>>1; // y = y/2 
//         x = (x*x) % p;   
//     } 
//     return res; 
// } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる





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

  int x=1;

  rep(i,n){
    x=min(x*2,x+k);
  }


  cout << x << endl;
}

Measured memory_bytes: 256
import math
from itertools import chain

N, K = map(int, input().split())

modulo = 10 ** 9 + 7
sqrtN  = int(math.sqrt(N))

P = [N // d for d in range(1, sqrtN + 1)]

# M[i] - 正の整数k個を並べたもののうち, 先頭がiで,
#        隣接する整数の積がN以下のものの個数 (mod modulo).

# k == 1 のときは M[i] == 1
M = {i: 1 for i in chain(P, range(1, P[-1]))}

# M2[i] - M[i] at k
# M2[i] = sum(M[j] for j such that 1 <= j <= N // i)
#       = M2[m] + sum(M[j] for j such that N//m < j <= N//i) (some m > i)
for k in range(2, K + 2):
    M2 = {}
    M2[N] = M[1]
    for m, i in zip(P, P[1:]):
        M2[i]  = M2[m] + sum(M[j] for j in range(N // m + 1, N // i + 1))
        M2[i] %= modulo
    for i in range(P[-1] - 1, 0, -1):
        M2[i]  = M2[i + 1] + M[N // i] * (N // i - N // (i + 1))
        M2[i] %= modulo
    M = M2

print(M[1])


Measured memory_bytes: 130360
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

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

  for(int i=0;i<S.size();i++){
    char tmp = S[i]+N;
    if(tmp > 90) {
      tmp -= 26;
    }

    cout << char(tmp);
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bits/stdc++.h>
#define int long long
using namespace std;

typedef long double db;


const int MAXN=1005;
const db eps=1e-9;

inline int sgn(db x)
{
    if(x>eps)return 1;
    if(x<-eps)return -1;
    return 0;
}

struct Point
{
    db x,y;
    Point(){}
    Point(db _x,db _y):x(_x),y(_y){}
    Point operator + (const Point &t)const
    {
        return Point(x+t.x,y+t.y);
    }
    Point operator - (const Point &t)const
    {
        return Point(x-t.x,y-t.y);
    }
    db operator * (const Point &t)const
    {
        return x*t.y-y*t.x;
    }
    db len()const
    {
        return sqrt(x*x+y*y);
    }
}p[MAXN];

db solve(Point p[],int n,Point s,Point t)
{
    vector<pair<db,int> >event;
    for(int i=0;i<n;i++)
    {
        int lef=sgn((p[i]-s)*(t-s));
        int rig=sgn((p[(i+1)%n]-s)*(t-s));
        if(lef==rig)continue;
        db r=((p[(i+1)%n]-s)*(p[(i+1)%n]-p[i]))/((t-s)*(p[(i+1)%n]-p[i]));
        event.push_back(make_pair(r,rig-lef));
        cout << r << " " << lef << " " << rig << endl;
    }
    sort(event.begin(),event.end());
    int cnt=0;
    db sum=0,la=0;
    for(int i=0;i<(int)event.size();i++)
    {
        if(cnt>0)sum+=event[i].first-la;
        la=event[i].first;
        cnt+=event[i].second;
    }
    return sum*(t-s).len();
}

int n,d[205][205];
vector<int> adj[205];

signed main()
{
int n;
cin >> n;
for(int i=0;i<n;i++){
    string s;
    cin >> s;
    for(int j=0;j<n;j++){
        if(s[j]=='1'){
            adj[i].push_back(j);
            d[i][j] = 1;
        }
        else d[i][j] = 1000000000;
    }
}
vector<int> side(n, -1);
bool is_bipartite = true;
queue<int> q;
int k = 0;
for (int st = 0; st < n; ++st) {
    if (side[st] == -1) {
        q.push(st);
        side[st] = 0;
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            for (int u : adj[v]) {
                if (side[u] == -1) {
                    side[u] = side[v] ^ 1;
                    q.push(u);
                } else {
                    is_bipartite &= side[u] != side[v];
                }
            }
        }
    }
}
for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]); 
        }
    }
}
for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(i!=j){
            k = max(k,d[i][j]);
        }
    }
}
cout << (is_bipartite ? k+1 : -1) << endl;
    return 0;
}

Measured memory_bytes: 1024