akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

template<typename T>
constexpr T _gcd(T m, T n) noexcept {
	T g = 1;

	while (m != 0) {
		if (m < n) std::swap(m, n);

		if (m & 1) {
			if (n & 1) m = (m - n) >> 1;
			else n = n >> 1;
		}
		else {
			if (n & 1) {
				m = m >> 1;
			}
			else {
				n = n >> 1;
				m = m >> 1;
				g = g << 1;
			}
		}
	}

	return g * n;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	ll* a = new ll[n];
	rep(i, n) cin >> a[i];

	ll ans = a[0];
	rep(i, n) {
		ans = _gcd(ans, a[i]);
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1152
class Node:
    def __init__(self, key, parent=None, left=None, right=None):
        self.key = key
        self.parent = parent
        self.left = left
        self.right = right


root = None

def insert(k):
    global root
    y = None
    x = root
    z = Node(k)

    while x is not None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right

    z.parent = y
    if y is None:
        root = z
    else:
        if z.key < y.key:
            y.left = z
        else:
            y.right = z


def find(u, k):
    while u is not None and k != u.key:
        if k < u.key:
            u = u.left
        else:
            u = u.right
    return u


def inorder(u):
    if u is None:
        return
    inorder(u.left)
    print(' %d' % u.key, end='')
    inorder(u.right)


def preorder(u):
    if u is None:
        return
    print(' %d' % u.key, end='')
    preorder(u.left)
    preorder(u.right)


n = int(input())
for i in range(n):
    cmd = input().split()
    if cmd[0] == 'insert':
        insert(int(cmd[1]))
    elif cmd[0] == 'find':
        if find(root, int(cmd[1])) is not None:
            print('yes')
        else:
            print('no')
    elif cmd[0] == 'print':
        inorder(root)
        print()
        preorder(root)
        print()


Measured memory_bytes: 85224
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from collections import Counter
def solve():
    mod = 10**9+7
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = [A[0]]
    fall_in = 0
    for i in range(1,N):
        fall_in += i - bisect_right(B,A[i])
        insort(B,A[i])
    c = Counter(A)
    double = 0
    for v in c.values():
        double += v*(v-1)//2
    fall_out = N*(N-1)//2 - double
    ans = fall_in * K % mod + fall_out * K*(K-1)//2 % mod
    ans %= mod
    return ans
print(solve())

Measured memory_bytes: 3572
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;

const LL INF=1<<30;
const LL MOD=1000000007;

LL gcd(LL a,LL b){
    if(b==0)return a;

    return gcd(b,a%b);
}


int main(){
    int n;cin>>n;
    vector<int>s(n);
    int sowa=0;
    vector<int> trlis;
    for(int i=0;i<n;++i){
        cin>>s[i];
        sowa+=s[i];
        if(s[i]%10!=0)trlis.push_back(s[i]);
    }
    
    if(trlis.size()==0)cout<<0<<endl;
    else{

    sort(trlis.begin(),trlis.end());
    int i=0;
    while(sowa%10==0){
        sowa-=trlis[i];
        i++;
    }
        cout<<sowa<<endl;
    }


}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, D);
  vector<int> c(26);
  rep(i, 26) cin >> c[i];
  vector<vector<int>> s(D, vector<int>(26));
  rep(i, D) rep(j, 26) cin >> s[i][j];
  rep(i, D) out((i % 26) + 1);
}


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

static const int MAX = 100;
static const int INF = (1<<21);
static const int WHI = 0;
static const int GRA = 1;
static const int BLA = 2;

int n, m[MAX][MAX];

int prim(){
  int u,minv;
  int d[MAX], p[MAX], color[MAX];
  
  for ( int i = 0; i < n ; ++i) {
    d[i] = INF;
    p[i] = -1;
    color[i] = WHI;
  }
  d[0] = 0;
  
  while (1) {
    minv = INF;
    u = -1;
    for ( int i = 0; i < n ; ++i) {
      if ( minv > d[i] && color[i] != BLA ) {
	u = i;
	minv = d[i];
      }
    }
    if ( u == -1 ) {
      break; 
    }
    color[u] = BLA;
    
    for ( int v = 0; v < n ; ++v) {
      if ( color[v] != BLA && m[u][v] != INF) {
	if ( m[u][v] < d[v] ) {
	  d[v] = m[u][v];
	  p[v] = u;
	  color[v] = GRA;
	}
      }
    }
  }
  int sum = 0;
  for ( int i = 0; i < n ; ++i) {
    if ( p[i] != -1 ) {
      sum += m[i][p[i]];
    }
  }
  return sum;
}

  
main()
{
  cin >> n;
  for ( int i = 0; i < n ; ++i) {
    for ( int j = 0; j < n ; ++j) {
      int e;
      cin >> e;
      if ( e == -1 ) {
	m[i][j] = INF;
      } else {
	m[i][j] = e;
      }
    }
  }

  cout << prim() << endl;

  return (0);
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  vec a(1<<n),r(1<<n),m(1<<n);
  for(ll i=0;i<(1<<n);i++) cin >> a[i];
  for(ll i=0;i<(1<<n);i++) {
    for(ll j=i;j<(1<<n);j=(j+1)|i) {
      r[j]=max(r[j],a[i]+m[j]);
      m[j]=max(m[j],a[i]);
    }
  }
  for(ll i=1;i<1<<n;i++) {
    r[i]=max(r[i],r[i-1]);
    cout << r[i] << endl;
  }
}

Measured memory_bytes: 9516
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int n;
char c[200][200];
int ans = 0;

// void calc(int r0, int c0, int r1, int c1){
//     // cout << r0 << " " << c0 << " " << r1 << " " << c1 << " " << ans << endl;    
//     int tate = -1;
//     int yoko = -1;
//     rep(i, r0, r1 + 1){
//         rep(j, c0, c1 + 1){
//             if(c[i][j] != 'x') break;
//             if(j == c1){
//                 yoko = i; i = r1 + 1;
//             }
//         }
//     }
//     rep(i, c0, c1 + 1){
//         rep(j, r0, r1 + 1){
//             if(c[j][i] != 'x') break;
//             if(j == r1){
//                 tate = i; i = c1 + 1;
//             }
//         }
//     }
//     cout << r0 << " " << c0 << " " << r1 << " " << c1 << " " << ans << " " << tate << " " << yoko << endl;    
//     if(tate == -1 || yoko == -1) return;
//     ans++;
//     calc(r0, c0, yoko - 1, tate - 1);
//     calc(r0, tate + 1, yoko - 1, c1);
//     calc(yoko + 1, c0, r1, tate - 1);
//     calc(yoko + 1, tate + 1, r1, c1);
// }

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 0, n){
        rep(j, 0, n){
            cin >> c[i][j];
        }
    }
    // calc(0, 0, n - 1, n - 1);
    rep(i, 0, n){
        rep(j, 0, n){
            if(c[i][j] == 'o'){
                ans++;
                rep(k, i, n){
                    rep(l, j, n){
                        if(c[k][l] == 'x'){
                            if(l == j){ k = n; break;}
                            break;
                        }
                        if(c[k][l] != 'x') c[k][l] = '!';
                    }
                }
            }
            // rep(k, 0, n){
            //     rep(l, 0, n){
            //         cout << c[k][l];
            //     }
            //     cout << endl;
            // }
            // cout << "===" << endl;
        }
    }
    // cout << ans << endl;
    cout << (ans - 1) / 3 << endl;
}
/*
7
oooxoxo
xxxxxxo
oooxoxo
xxxxxxx
oooxoxo
xxxxxxo
oooxoxo

ans: 3

*/

Measured memory_bytes: 3152
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;

int n;
int a[100005];

int main(int argc, char const *argv[]) {
	cin >> n;
	// FOR(i, n) cin >> a[i];
	// if (n <= 2) {
	// 	cout << 1 << endl;
	// 	return 0;
	// }

	bool up = true, down = true;
	int last, res = 1;
	cin >> last;
	FOR(i, n-1) {
		int cur;
		cin >> cur;
		if (last == cur) continue;
		else if (last < cur) {
			if (down && !up) {
				res++;
				up = true;
			}
			else if (down && up) {
				down = false;
			}
		}
		else if (last > cur) {
			if (!down && up) {
				res++;
				down = true;
			}
			else if (down && up) {
				up = false;
			}
		}
		last = cur;
	}
	// FOR(i, n) cout << a[i] << endl;
	cout << res << endl;
	return 0;
}

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

int main(){
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;
  
  if (A1 + A2 + A3 >= 22){
    cout << "bust" << endl;
  }
  else {
    cout << "win" << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env fsharpi

open System;

let ParseIntN ( str : string ) =
    str.Split(' ')
    |> Array.map System.Int32.Parse

let ParseInt1 ( str : string ) =
    ParseIntN str |> fun arr -> arr.[0]

let ParseInt2 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1])

let ParseInt3 ( str : string ) =
    ParseIntN str |> fun arr -> (arr.[0],arr.[1],arr.[2])

let ReadLinesN ( n : int ) =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.take n

let ReadLines =
    fun _ -> Console.ReadLine()
    |> Seq.initInfinite
    |> Seq.takeWhile ((<>) null)

module String =
    /// Converts a string into a list of characters.
    let explode (s:string) =
        [for c in s -> c]

    /// Converts a list of characters into a string.
    let implode (xs:char list) =
        let sb = System.Text.StringBuilder(xs.Length)
        xs |> List.iter (sb.Append >> ignore)
        sb.ToString()

Console.ReadLine()
|> String.explode
|> fun s -> List.fold ( fun (last,count) c -> if last <> c then (c,count+1) else (last,count) ) ((List.head s),0) (List.tail s)
|> fun (_,count) -> printf "%A" count


Measured memory_bytes: 23640
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
// #define ll long long
typedef long long ll;
typedef pair<int, int> P;



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

  // double n,d;
  // cin >> n >> d;
  // double mm = n/((d*2.0)+1.0);
  // cout << ceil(mm) << endl;
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
  }
  int maxElementIndex = std::max_element(a.begin(),a.end()) - a.begin();
  int maxElement = *std::max_element(a.begin(), a.end());
  a.erase(a.begin()+maxElementIndex);
  int nextmaxElement = *std::max_element(a.begin(), a.end());
  rep(i,n){
    if (i == maxElementIndex){
      cout << nextmaxElement << endl;
    }else{
      cout << maxElement << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
using Graph = vector<vector<int>>;
using Graphl = vector<vector<ll>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a)  (a).rbegin(),(a).rend()
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; }
template<class T> void PrintVector(const vector<T> &vec) {for (auto val : vec) cout << val << " "; cout << endl;}
const long long INF = 1LL << 60;
const long long minusINF = -(1LL << 40);
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int n, T; cin >> n >> T;
    int ans = 1100;
    bool f = false;
    rep(i, n)
    {
        int c, t; cin >> c >> t;
        if (T >= t)
        {
            ans = min(ans, c);
            f = true;
        }
    }
    if (f) cout << ans << endl;
    else cout << "TLE" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
using namespace std;

int main(){

    string S,s_;
    cin>>S;
    int N=S.size();
    s_=S.substr(N-1);
    if(s_ == "s"){
        cout<<S<<"es"<<endl;
    }else{
        cout<<S<<"s"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] gems = new long[N];
		long result = 0;
		long min = 0;
		int count = 0;
		for (int i = 0; i < N; i++) {
			if (sc.hasNext()) {
				gems[i] = sc.nextLong();
				result += Math.abs(gems[i]);
				if (i == 0 || min > Math.abs(gems[i])) {
					min = Math.abs(gems[i]);
				}
				if (gems[i] <= 0) {
					count++;
				}
			}
		}
				
		if (count == 0 || count%2 == 0) {
			System.out.println(result);
		} else {
			System.out.println(result-2*min);
		}
		
	}

}


Measured memory_bytes: 62000
#include<stdio.h>
#define LIMIT 1000000007

int main(void)
{
	long n,k,i,j;
	long sum=0,min=0,max=0;
	int flag=1;

	scanf("%ld %ld",&n,&k);

	for(i=k;i<=n+1;i++){
		if(flag){
			for(j=0;j<i;j++){
				min+=j;
			}
			for(j=n;j>n-i;j--){
				max+=j;
			}
			flag=0;
		}
		else{
			min+=i-1;
			max+=n-i+1;
		}
		sum+=max-min+1;
	}
	sum=sum%LIMIT;

	printf("%ld\n",sum);
	return 0;
}


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

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;
    for(int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];
    
    bool can = true;
    for(int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if(dt < dist) can = false;
        if(dist % 2 != dt % 2) can = false;
    }
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 1408
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        if (x-500*i-100*j)%50==0 and (x-500*i-100*j)//50<=c and (x-500*i-100*j)>=0:
            ans+=1

print(ans)


Measured memory_bytes: 3060
#f(0, A)^f(0, B) = f(A+1, B)

#各桁について貪欲に0か1か決める
#0からAまで一つずつ見ていったのでは間に合わないので、周期を利用する
#0桁目の周期は2, 1桁目の周期は4,...
#また,0からAまでの整数の個数はA+1個であることに留意する
def calc(A):
    if A < 0:
        return 0

    ans = 0
    # A <= 10^12 < 2**40
    for i in range(50): #i桁目について考える
        cnt = 0 #i桁目の1の個数
        loop = 1 << i+1 #0...1...の周期
        cnt += (A+1) // loop * (loop // 2) #(ループした回数)*(1つのループの中での1の個数)
        cnt += max(0, (A+1) % loop - (loop // 2)) #余った部分の1の個数
        if cnt % 2 == 1:
            ans += 1 << i 
    return ans    

a = list(map(int,input().split()))
A = a[0]
B = a[1]
ans = calc(B) ^ calc(A-1)
print(str(ans))

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int inf = 1e8;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, m, r;
	cin>>n>>m>>r;
	vector<int> v(r), p(r);
	for(int i = 0; i < r; i++){
		cin>>v[i];
		p[i] = i;
	}
	vector<vector<int> > dist(n + 1, vector<int>(n + 1, inf));
	for(int i = 1; i <= n; i++){
		dist[i][i] = 0;
	}
	for(int i = 0; i < m; i++){
		int a, b, c;
		cin>>a>>b>>c;
		dist[a][b] = min(dist[a][b], c);
		dist[b][a] = min(dist[b][a], c);
	}
	for(int k = 1; k <= n; k++){
		for(int i = 1; i <= n; i++){
			for(int j = 1; j <= n; j++){
				dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	ll ans = inf;
	while(true){
		ll sum = 0;
		for(int i = 1; i < r; i++){
			sum += dist[v[p[i - 1]]][v[p[i]]];
		}
		ans = min(ans, sum);
		if(!next_permutation(p.begin(), p.end()))break;
	}
	cout<<ans<<'\n';

	return 0;
}

Measured memory_bytes: 384
/**
 *    author:  tourist
 *    created: 31.03.2018 18:21:48       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  auto good = [&](long long mask) {
    for (int i = 0; i < n; i++) {
      vector<int> can(51, false);
      can[a[i]] = true;
      for (int j = 50; j >= 0; j--) {
        if (can[j]) {
          for (int u = 1; u <= 50; u++) {
            if (mask & (1LL << u)) {
              can[j % u] = true;
            }
          }
        }
      }
      if (!can[b[i]]) {
        return false;
      }
    }
    return true;
  };
  long long mask = (1LL << 51) - 1;
  if (!good(mask)) {
    cout << -1 << '\n';
    return 0;
  }
  for (int bit = 50; bit >= 0; bit--) {
    if (good(mask ^ (1LL << bit))) {
      mask ^= (1LL << bit);
    }
  }
  cout << mask << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#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
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	int n = 'z' - 'a' + 1;
	string s;
	cin >> s;
	vector<bool> b(n, true);
	if (s == "zyxwvutsrqponmlkjihgfedcba") {
		cout << -1 << endl;
		return 0;
	}
	rep(i, s.size()) {
		b[s[i] - 'a'] = false;
	}
	rep(i, n) {
		if (b[i]) {
			cout << s << (char)(i+'a')<< endl;
			return 0;
		}
	}
	rep(i, s.size()) {
		int j = s.size() - i - 1;
		if (j!=0&&s[j] > s[j - 1]) {
			b[s[j] - 'a'] = true;
			rep(k, j - 1) {
				cout << s[k];
			}
			range(k, s[j - 1]-'a',n) {
				if (b[k]) {
					cout << (char)(k + 'a') << endl;
					return 0;
				}
			}
		}
		else b[s[j]-'a'] = true;
	}
}


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

int main(){
  int h,w;
  cin >> h >> w;
  vector<vector<char>> a(h,vector<char> (w));
  vector<bool> b(h),c(w);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> a[i][j];
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a[i][j]=='#'){
         b[i]=true;
      }
    }
  }
  for(int j=0;j<w;j++){
    for(int i=0;i<h;i++){
      if(a[i][j]=='#'){
         c[j]=true;
      }
    }
  }
  for(int i=0;i<h;i++){
    if(b[i]){
    for(int j=0;j<w;j++){
      if(c[j]){
          cout << a[i][j];
        }
      }
      cout << endl;
    }
  }
}

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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	gcd(int A, int B) {
	while (0!=B) {
		A %=B;
		swap(A, B);
	}
	return A;
}

ll	gcd(ll A, ll B) {
	while (0!=B) {
		A %=B;
		swap(A, B);
	}
	return A;
}

ll	lcm(ll A, ll B) {
	ll G=gcd(A, B);
	return A/G*B;
}

ll	GCD(vector<ll> &A) {
	ll B=A.at(0);
	for (ll i=1; i<A.size(); i++)
		B =gcd(B, A.at(i));
	return B;
}

ll	LCM(vector<ll> &A) {
	ll B=A.at(0);
	for (ll i=1; i<A.size(); i++)
		B =lcm(B, A.at(i));
	return B;
}

int	main() {
	int N;
	cin >>N;
	vector<ll> A(N, 0);
	vector<int> P(1000001, 0);
	Rep0(i, N)
		cin >>A.at(i);
	bool PC=true;
	for (auto AA: A) {
		for (auto i=1; i<=sqrt(AA); i++) {
			if (0==AA%i) {
				int A0=i;
				if (1!=A0) {
					if (P.at(A0)!=0) {
						PC=false;
						break;
					}
					P.at(A0)=1;
				}
				A0=AA/i;
				if (A0!=i) {
					if (1!=A0) {
						if (P.at(A0)!=0) {
							PC=false;
							break;
						}
						P.at(A0)=1;
					}
				}
			}
			if (!PC)
				break;
		}
		if (!PC)
			break;
	}
	if (PC) {
		cout <<"pairwise coprime" <<endl;
	} else {
		if (1==GCD(A)) {
			cout <<"setwise coprime" <<endl;
		} else {
			cout <<"not coprime" <<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 14936
#a, b,c ,d = map(int, input().split())
#m = int(input())
A = list(map(int, input().split()))
res = True
if 1 not in A:
    res = False
if 9 not in A:
    res = False
if 7 not in A:
    res = False
if 4 not in A:
    res = False
if res:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int N;
string S;
  cin >> N >> S;
int K;
  cin >> K;

  char moji;
  moji = S.at(K - 1);
  for(int i = 0;i < N;i++){
  if(S.at(i) == moji) cout << moji;
    else cout << "*";
  }
 
return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const VI coin{10, 50, 100, 500};
void solve(int n) {
    VI cnum(4), ans(4, 0), csum(4, 0);
    int coinnum = 0, sum = 0;
    REP(i, 4) {
        cin >> cnum[i];
        coinnum += cnum[i];
        csum[i] = cnum[i] * coin[i];
        sum += csum[i];
    }
    int amari = sum - n;
    RREP(i, 4) {
        int buf = amari / coin[i];
        amari %= coin[i];
        ans[i] = cnum[i] - buf;
    }
    REP(i, 4) {
        if (ans[i] > 0) cout << coin[i] << " " << ans[i] << endl;
    }
    return;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    while (cin >> n, n) {
        if (f) cout << endl;
        solve(n);f = true;
        //return 0;
    }
}

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

void printarr(int* a, int len){
    for(int i = 0; i < len - 1; i ++){
        cout << a[i] << " ";
    }
    cout << a[len - 1] << endl;
}

void insertionSort(int* a, int len){
    for (int i = 1; i < len; i ++){
        printarr(a, len);
        int v = a[i];
        int j = i - 1;

        while (j >= 0 && a[j] > v){
            a[j + 1] = a[j];
            j --;
        }
        a[j + 1] = v;
    }
}

int main(){
    int N, s;
    cin >> N;
    int a[N];
    for(int i = 0; i < N; i ++){
        cin >> s;
        a[i] = s;
    }
    insertionSort(a, N);
    printarr(a, N);
    return 0;
}


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

#define MAX_N 1000

string s0;
string s1;

int dp[MAX_N + 1][MAX_N + 1];

int main()
{
	cin >> s0 >> s1;

	int sz0 = s0.size();
	int sz1 = s1.size();
	for( int i = 0; i <= sz0; i++ ) {
		dp[i][0] = i;
	}
	for( int i = 0; i <= sz1; i++ ) {
		dp[0][i] = i;
	}
	for( int i = 1; i <= sz0; i++ ) {
		for( int j = 1; j <= sz1; j++ ) {
			int c = 0;
			if( s0[i - 1] != s1[j - 1] ) {
				c = 1;
			}
			dp[i][j] = min( dp[i - 1][j] + 1, min( dp[i][j - 1] + 1, dp[i - 1][j - 1] + c ) );
		}
	}
	int ans = dp[sz0][sz1];

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 7152
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int a, b;
string s;

int main(){
    cin >> a >> b;
    cin >> s;
    int ac = 0, bc = 0, ch = 0;
    for(int i = 0; i < s.length(); i++){   
        if(i != a){
            if(s[i] == '-'){
                cout << "No\n";
                return 0;
            }
            if(ch == 0){
                ++ac;
            }
            else{
                ++bc;
            }
        }
        else{
            if(s[i] != '-'){
                cout << "No\n";
                return 0;
            }
            ch = 1;
        }
    }

    if(ac != a || bc != b){
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

int a[5];
int main()
{
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false); cin.tie(0);
    string s;
    cin >> s;
    FOR(i, 1, SZ(s))
    {
        string s1 = s.substr(0, SZ(s) - i);
        if (SZ(s1) % 2 == 0 && s1.substr(0, SZ(s1)/2) == s1.substr(SZ(s1)/2, SZ(s1)/2))
        {
            cout << SZ(s) - i;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll k,a,b;
cin>>k>>a>>b;
if(b-a-2<=0){
cout << k+1 << endl;}
else{
cout << k+1+(b-a-2)*((k+1-a)/2) << endl;}}

Measured memory_bytes: 3580
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>

using namespace std;

typedef long long ll;

inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
ll mod_inv(ll a,ll p){
  if (a == 0) throw "NG";
  return pow_mod(a,p-2,p);
}

int MOD;

inline int in(){int x;scanf("%d",&x);return x;}
//{{{ lex_parser.hpp
#ifndef INCLUDE_LEX_PARSER_HPP
#define INCLUDE_LEX_PARSER_HPP
#include <iostream>
#include <string>
#include <cctype>
namespace orliv {
template<typename T, bool Check=false>
struct LexParser {
  typedef T expr_t;
  typedef std::string::const_iterator state_t;
  LexParser(){}
  expr_t eval(const std::string& expr){
    auto s = expr.begin();
    auto r = expression(s);
    consume(s, '=');
    return r;
  }
  inline void consume(state_t& s, char expected){
    if (!Check || *s == expected){
      s++;
      return;
    }
    std::cerr << "Expected '" << expected << "' but got '" << *s << "'" << std::endl;
    std::cerr << "Rest string is '";
    while (*s) std::cerr << *s++;
    std::cerr << "'" << std::endl;
  }
  expr_t number(state_t& s){
    expr_t r = 0;
    while (std::isdigit(*s)){
      r = r * 10 + (*s - '0');
      s++;
    }
    return r % MOD;
  }
  expr_t term(state_t& s){
    expr_t r = factor(s);
    while (1){
      if (*s == '*'){
        consume(s, '*');
        r *= factor(s);
        r %= MOD;
      }
      else if (*s == '/'){
        consume(s, '/');
        r *= mod_inv(factor(s), MOD);
        r %= MOD;
      }
      else break;
    }
    return r % MOD;
  }
  expr_t factor(state_t& s){
    expr_t r;
    if (*s == '('){
      consume(s, '(');
      r = expression(s);
      consume(s, ')');
    }
    else r = number(s);
    return r % MOD;
  }
  expr_t expression(state_t& s){
    expr_t r = term(s);
    while (1){
      if (*s == '+'){
        consume(s, '+');
        r += term(s);
        r %= MOD;
      }
      else if (*s == '-'){
        consume(s, '-');
        r += MOD - term(s);
      }
      else break;
    }
    return r % MOD;
  }
};
}
#endif
//}}}

int main()
{
  string S;
  while (getline(cin, S), S != "0:"){
    stringstream ss(S);
    string ps, expr;
    getline(ss, ps, ':');
    getline(ss, expr, ':');

    MOD = atoi(ps.c_str());
    expr.erase(remove_if(expr.begin(), expr.end(), [](const char& a){ return a == ' '; }), expr.end());
    orliv::LexParser<ll> lex;
    try {
      ll res = lex.eval(expr);
      cout << expr << " = " << res << " (mod " << MOD << ")\n";
    }
    catch (const char* e){
      cout << e << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1524
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
const ll MOD=1e9+7;
const int N=500000;


main(){
    int n=in();
    int a=in();
    vec v;
    rep(i,n)v.pb(in()-a);
    vector<map<int,ll>> dp(n+1);
    dp[0][0]=1;
    rep(i,n){
        for(auto e:dp[i]){
            dp[i+1][e.first+v[i]]+=e.second;
            dp[i+1][e.first]+=e.second;
        }
    }
    cout<<dp[n][0]-1;
}

Measured memory_bytes: 1664
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.util.Arrays.binarySearch;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 998244353;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        long K = in.nextLong();
        long[] a = new long[n];
        long[] b = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }
        for (int i = 0; i < n; i++) {
            b[i] = in.nextLong();
        }
        Arrays.sort(a);
        Arrays.sort(b);
        long l = 0, r = 1000000000000L;
        while (l < r) {
            long m = (l + r) >> 1;
//            m = 1;
            if (check(b, a, m, K)) {
                r = m;
            } else {
                l = m + 1;
            }
        }
        out.println(l);
    }

    private boolean check(long[] a, long[] b, long m, long k) {
        long kk = 0;
        int n = b.length;
        for (int i = n - 1; i >= 0; i--) {
            if (b[i] * a[n - 1 - i] > m) {
               kk += b[i] - m / a[n - 1 - i];
            }
        }
        return kk <= k;
    }


}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

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

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

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

}


Measured memory_bytes: 54692
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]

n,m = MI()
a = sorted(LI())[::-1]
asum = sum(a)
if a[:m][-1]>=asum*(1/(4*m)):
    print('Yes')
else:
    print('No')

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

const int maxn=1e5+9;

int main()
{
    int t;
    cin>>t;
    int a=t%10;
    int b=t%100/10;
    int c=t/100;

    if(a==1) a=9;
    else if(a==9) a=1;

    if(b==1) b=9;
    else if(b==9) b=1;

    if(c==1) c=9;
    else if(c==9) c=1;
    printf("%d\n",c*100+b*10+a);

    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
has_snack = [False]*N
# has_snack: 1つ以上のお菓子を持っているかどうか
# has_snack[i] = True なら、すぬけ君i+1は1つ以上のお菓子を持っている

for i in range(K):
    d = int(input())  # d を読む (使わないけど)
    A = list(map(int, input().split()))  # A を読む
    for v in A:  # A の各要素 v について、
        has_snack[v-1] = True  # すぬけ君vは1つ以上のお菓子を持っている

# sum(has_snack) で1つ以上のお菓子を持っているすぬけ君の人数を求める
# ↑ 暗黙に、Trueは1、Falseは0に変換される
# 求めたいのは1つも持っていないすぬけ君の人数なので、総数Nから引く
print(N - sum(has_snack))

Measured memory_bytes: 9188
(defun main ()
  (let* ((n (read)) 
         (str (read-line)) 
         (half (floor n 2))
         (str-t (subseq str 0 half)))
    (if (equal str-t (subseq str half)) 
        (format t "~a~%" "Yes")
        (format t "~a~%" "No"))))
(main)

Measured memory_bytes: 13544
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    PY = [il() for _ in range(M)]
    k = {}
    sortPY = sorted(PY, key=lambda x: (x[0], x[1]))

    tmp = 0
    cnt = 1
    for p, y in sortPY:
        if p != tmp:
            cnt = 1
            tmp = p
        else:
            cnt += 1

        k[y] = cnt

    for p, y in PY:
        print(str(p).zfill(6) + str(k[y]).zfill(6))


if __name__ == '__main__':
    main()


Measured memory_bytes: 45328
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
//#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9+7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 2e18;

long long gcd(long long x, long long y) {
    long long m = max(x, y), n = min(x, y);
    if (m%n == 0)return n;
    else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
    return x / gcd(x, y)*y;
}


void solve() {
    ll a,b;cin>>a>>b;
    print(lcm(a,b));
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
}


Measured memory_bytes: 256
/* To Kaise Hain Aaplog*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) (x).begin(), (x).end()

void shuru_krte_hai_bina_kisi_bakchodi_ke()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
const ll m = 998244353;

const ll s = 1e6+2;
ll a[s];
int main()
{
    //shuru_krte_hai_bina_kisi_bakchodi_ke();

    /* long long yaad se daal de har jagah*/
    #define int long long
    int n;
    cin>>n;
    int mx = -1;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        a[x]++;
        mx = max(x,mx);
    }
    for(int i=0;i<s;i++){
        if(a[i]==0){
            continue;
        }
        if(a[i]>=2){
            a[i] = 0;
        }
        for(int j=2*i;j<=mx;j+=i){
            if(a[j]>0){
                a[j] = 0;
            }
        }
    }
    int nos = 0;
    for(int i=0;i<s;i++){
        nos+=a[i];
    }
    cout<<nos;
    return 0;
}

Measured memory_bytes: 11428
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String s;
        int count = 0;
        int max = 0;

        int sLen = S.length();
        int tLen = T.length();
        for (int i = 0; i <= sLen - tLen; i++) {    //T文字列が入りきるところまでループ
            s = S.substring(i, i + tLen);           //1文字ずつずらして取り出し
            count = 0;
            for (int j = 0; j < tLen; j++) {
                if (s.charAt(j) == T.charAt(j)) {   //取り出した文字列を1文字ずつ比較
                    count++;                        //一致したらcount++;
                }
            }
            if (max < count) {
                max = count;
            }
        }
        System.out.println(tLen - max);
    }
}


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

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

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

  string s; cin >> s;
  int N = s.size();
  stack<char> stc;
  rep(i, N) {
    if(!stc.empty() && stc.top() == 'S' && s[i] == 'T') stc.pop();
    else stc.push(s[i]);
  }

  cout << stc.size() << '\n';
  return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e6 + 6;
const ll MOD = 1e9 + 7;

int n, r1, r2, c1, c2;
ll fact[N], invfact[N];

ll invmod(ll a) {
  ll b = MOD - 2;
  ll res = 1;
  for (; b; (a *= a) %= MOD, b >>= 1) {
    if (b & 1) (res *= a) %= MOD;
  }
  return res;
}

void init() {
  cin >> r1 >> c1 >> r2 >> c2;
  n = r2 + c2 + 1;
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) fact[i] = (fact[i - 1] * i) % MOD;
  invfact[n] = invmod(fact[n]);
  for (int i = n; i >= 1; --i) invfact[i - 1] = (invfact[i] * i) % MOD;
}

ll nCr(int n, int r) {
  return (((fact[n] * invfact[n - r]) % MOD) * invfact[r]) % MOD;
}

ll calc(int c) {
  ll res = 0;
  for (int i = r1; i <= r2; ++i) {
    // f(r + 1, c) = f(r, 0) + f(r, 1) + .. + f(r, c)
    // res += f(i + 1, c)
    (res += nCr(i + 1 + c, c)) %= MOD;
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  init();
  cout << ((calc(c2) - calc(c1 - 1)) % MOD + MOD) % MOD;
  return 0;
}

Measured memory_bytes: 31488
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC96_B
{
    class Program
    {
        static void Main(string[] args)
        {

            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var k = int.Parse(Console.ReadLine());

            Console.WriteLine(a.Sum() + Math.Pow(2, k) * a.Max() - a.Max());
        }
    }
}


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

using namespace std;

#define MOD 1000000007

int main() {
	int n; cin >> n;
	vector<vector<int> > a(n, vector<int>(n));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			cin >> a[i][j];
	vector<vector<long long> > dp(n + 1, vector<long long>(1 << n));
	dp[0][0] = 1;
	for (int i = 0; i < n; ++i)
		for (int flag = 0; flag < (1 << n); ++flag)
			if (i == __builtin_popcount(flag))
				for (int j = 0; j < n; ++j)
					if (!(flag & (1 << j)) && a[i][j])
                    	(dp[i + 1][flag | (1 << j)] += dp[i][flag]) %= MOD;
	cout << dp[n][(1 << n) - 1] << endl;

	return 0;
}

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

int main() {
	int n;
	cin>>n;
	int serch=1;

	rep(i,n){
		int a;
		cin>>a;
		
		if(a==serch){
			serch++;
		}
		
	}
	
	serch--;//探している値-1が見つかった値
	if(serch==0)cout<<-1<<endl;
	else cout<<n-serch<<endl;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string;

wchar[600][600] BD1, BD2;

void main()
{
    auto N = readln.chomp.to!int;

    foreach (i; 0..N) {
        foreach (j, c; readln.chomp) {
            BD1[i][j] = BD1[i][N+j] = BD1[N+i][j] = BD1[N+i][N+j]= c;
            BD2[j][i] = BD2[j][N+i] = BD2[N+j][i] = BD2[N+j][N+i] = c;
        }
    }

    int cnt;
    foreach (a; 0..N) {
        foreach (b; 0..N) {
            foreach (i; 0..N) {
                if (BD1[a+i][b..N+b] != BD2[b+i][a..N+a]) goto bad;
            }
            ++cnt;
            bad:
        }
    }
    writeln(cnt);
}

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<climits>

using namespace std;

int func(vector<int> num){
  int ans=0;
  for(int i=0;i<num.size()-1;i++)
    ans+=(num[i+1]-num[i])*(num[i+1]-num[i]);
  return ans;
}


int main(void){

  int a,b,tmp;
  vector<int>num;

  while(cin >> a >> b,a|b){
    int res=INT_MAX;
    for(int i=1;i*i<=a;i++)
      for(int j=1;j*j<=b;j++)
	if(a%i==0 && b%j==0){
	  num.clear();
	  num.push_back(a/i);
	  num.push_back(i);
	  num.push_back(b/j);
	  num.push_back(j);
	  sort(num.begin(),num.end());
	  res=min(res,func(num));
	}

    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 1216
N = int(input())
HList = list(map(int,input().split()))
count = 1
max1 = HList[0]
for i in range(1,N):
    if max1 <= HList[i]:
        count += 1
    if max1 < HList[i]:
        max1 = HList[i]
print(count)


Measured memory_bytes: 2940