akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  bool t=true;
  int count=0;
  for(int i=1;i<10;i++){
    count++;
    if(i==n){
      t=false;
      cout << count << endl;
      break;
    }
  }
  if(t){
    if(n<100){
      t=false;
      cout << count << endl;
    }else{
      for(int i=100;i<1000;i++){
        count++;
        if(i==n){
          t=false;
          cout << count << endl;
          break;
        }
      }
    }
  }
    if(t){
      if(n<10000){
        t=false;
        cout << count << endl;
      }else{
      for(int i=10000;i<100000;i++){
        count++;
        if(i==n){
          t=false;
          cout << count << endl;
          break;
        }
      }
      }
    }
  if(t)cout << count << endl;
}

Measured memory_bytes: 3608
using System;
using System.IO;

class Solve
{
    static void Main(string[] args) {
        var arr = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int M = arr[1];
        var lMax = 0;
        var rMin = 100000;
        for (int i = 0; i < M; i++) {
            var L = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            lMax = Math.Max(lMax, L[0]);
            rMin = Math.Min(rMin, L[1]);
        }
        var answer = lMax <= rMin ? rMin - lMax + 1 : 0;
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

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

int main() {
  int n,ans=0;
  while(cin >> n) {
    if(n==0)break;
    while(n!=1) {
      if(n%2==0) {
        n /= 2;
      }
      else {
        n = 3*n+1;
      }
      ans++;
    }
    cout << ans << endl;
    ans = 0;
  }
}

Measured memory_bytes: 0
N, Y = map(int, input().split())
Y //= 1000
k = min((Y - N) // 4, Y // 5)
if 9 * k >= 2 * (Y - N):
    x = (Y - N) - 4 * k
    y = -2 * (Y - N) + 9 * k
    z = Y - 5 * k
    print(x, y, z)
else:
    print(-1, -1, -1)

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;
    set<ll> s;

    NREP() {
        ll tmp;
        cin >> tmp;
        if (s.find(tmp) != s.end()) {
            MSG("NO")
            exit(0);
        } else {
            s.insert(tmp);
        }
    }

    MSG("YES")
}


Measured memory_bytes: 9600
#include<iostream>
using namespace std;
int main()
{
	int a;
	cin>>a;
	int x=0;
	string s;
	cin>>s;

	for(int i=0;i<a;i++)
	{
	
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') x++;
		}
		cout<<x<<endl;
	
	return 0;
}


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

int N, W, m;
int dp[100010];
int w[110], v[110];
int main() {
	scanf("%d %d", &N, &W);
	rep(i, N) {
		scanf("%d %d", &w[i], &v[i]);
		m += v[i];
	}
	rep(i, m + 1) dp[i] = (int)1e9;
	dp[0] = 0;
	rep(i, N) for (int j = m; j >= v[i]; --j) dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
	Rep(i, m) {
		if (dp[i] <= W) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	int T;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Main tr = new Main();
		tr.test(sc);
		sc.close();
	}
	
	void test(Scanner sc){
		int N = sc.nextInt();
		int i=sc.nextInt();
		int out = N+1-i;
		System.out.println(out);
	}
}


Measured memory_bytes: 21076
n,m=map(int,input().split())
x = [int(i) for i in input().split()]
x.sort()
ans = []
for i in range(m-1):
    ans.append(x[i+1]-x[i])
ans.sort()


if n>=m:
    print(0)
else:
    cnt =0
    for i in range(m-n):
        cnt +=ans[i]
    print(cnt)

Measured memory_bytes: 56872
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define INF 1000000000
#define MOD 1000000007

int main(){
    int N; cin >> N;
    vector<int> D(N);
    for(int &d:D)
        cin >> d;
    
    sort(D.begin(), D.end());
    int ans = 1;
    for(int i=0; i<N-1; i++)
        if(D[i+1]!=D[i]) ans++;
    cout << ans << endl;
    return 0;
}


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

int main(){

  int n,nn ,digit=0, count=0;
  scanf("%d", &n);


  for(int i=1; i<=n; i++){

    nn=i;
    digit=0;
    while(nn!=0){
    nn = nn / 10;
    digit++;
    }
    if(digit%2==1) ++count;


  }

  printf("%d", count);

}


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

int main()
{
  i64 n;
  cin >> n;
  vector<i64> d(n);
  for (i64 i = 0; i < n; i++)
    cin >> d[i];
  sort(d.begin(), d.end());
  vector<i64> t(n);
  for (i64 i = 0; i < n; i++)
    t[i] = abs(24 * (i % 2) - d[i]);
  i64 ans = d[0];
  for (i64 i = 0; i < n; i++)
    for (i64 j = 0; j < i; j++)
      ans = min({ans, abs(t[i] - t[j]), 24 - abs(t[i] - t[j])});
  cout << ans << endl;
  return 0;
}


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

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

using namespace std;

template <class T>
void printv(vector<T> v)
{
  cout << '[';
  for (auto vec: v)
  {
    cout << vec << ' ';
  }
  cout << ']' << endl;
}

int main()
{
  long long n, m;
  cin >> n >> m;
  vector<long long> s;
  vector<long long> v;

  for (int i = 0; i < n; i++)
  {
    long long tmp;
    cin >> tmp;
    s.push_back(tmp);
  }

  sort(s.begin(), s.end());

  for (int i = m-1; i < n; i++)
    v.push_back(s[i] - s[i - (m - 1)]);

  sort(v.begin(), v.end());

  cout << v[0] << endl;
}

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

int n;
queue<int> Q, R;

int main()
{
    for(int i = 0; i < 10; i++)
        Q.push(i);

    for (int i = 5; i > 0; i--)
        Q.push(i);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int a, b;

        cin >> a >> b;

        int c = Q.front();

        while (c != a) {
            Q.push(c);
            Q.pop();
            c = Q.front();
        }

        if (a == 0 || a > 5) {
            while (c != b) {
                cout << c << " ";
                Q.push(c);
                Q.pop();
                c = Q.front();
            }
        }
        else {
            R.push(c);
            Q.push(c);
            Q.pop();
            c = Q.front();

            while (c != b && c != a) {
                R.push(c);
                Q.push(c);
                Q.pop();
                c = Q.front();
            }

            if (c == a) {
                while (c != b) {
                    cout << c << " ";
                    Q.push(c);
                    Q.pop();
                    c = Q.front();
                }
            }
            else {
                while (!R.empty()) {
                    cout << R.front() << " ";
                    R.pop();
                }
            }
        }

        cout << b << endl;
    }

    return 0;
}



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


void solve(long long N){
    ll i;
    for(i=1; i*i <= N; i++)
        continue;
    
    cout << (i-1)*(i-1) << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
data = {(1,2):(6,300), (1,3):(13,500), (1,4):(18,600), 
        (1,5):(23,700), (1,6):(43,1350), (1,7):(58,1650), 
        (2,3):(7,350), (2,4):(12,450), (2,5):(17,600), 
        (2,6):(37,1150),(2,7):(52,1500), (3,4):(5,250), 
        (3,5):(10,400), (3,6):(30,1000), (3,7):(45,1350), 
        (4,5):(5,250), (4,6):(25,850), (4,7):(40,1300), 
        (5,6):(20,600), (5,7):(35,1150), (6,7):(15,500)}

while True:
    s = input()
    if s == 0: break
    sh, sm = map(int, raw_input().split())
    g = input()
    gh, gm = map(int, raw_input().split())
    flag = False
    for h, m in [(sh, sm), (gh, gm)]:
        if (h == 17 and 30 <= m) or (h == 18) \
        or (h == 19 and m <= 30):
            flag = True
            break
    key = (s,g) if s < g else (g,s)
    if flag and data[key][0] <= 40:
        p = str(data[key][1]/2)
        if int(p[-2:]) == 0:
            print p
        elif int(p[-2:]) <= 50:
            print p[0]+'50'
        else:
            print str(int(p[0])+1)+'00'
    else:
        print data[key][1]

Measured memory_bytes: 4368
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 310, p = 998244353;
char w[maxn];
int n, k, c1;
ll res;
vector<int> c;
ll dp[maxn][maxn][maxn], pf[maxn][maxn][maxn];

void add(auto &a, auto v) {
	a += v - p;
	a += (a>>63) & p;
}
void get_ans() {
	//for (int i = 0;i <= k;++i) dp[0][0][i] = 1;
	dp[0][0][0] = 1;
	int lst = 0, sum = 0;
	for (int i = 1;i <= c.size();++i) {
		int cp = c[i-1];
		sum += cp;
		for (int j = sum;j <= c1;++j) {
			for (int w = 0;w <= j;++w) {
				int cost = max(0, w - cp);
				for (int s = cost;s <= k;++s) 
					add(dp[i][j][s], dp[i-1][j-w][s-cost]);
			}
		}
	}
	for (int s = 0;s <= k;++s)
		add(res, dp[c.size()][c1][s]);
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> w+1 >> k;
	n = strlen(w+1);
	for (int i = 1, cnt = 0;i <= n+1;++i) {
		if (w[i] == '1') ++cnt;
		else c.pb(exchange(cnt, 0));
	}
	c1 = count(w+1, w+1+n, '1');
	k = min(k, c1);
	if (c.size() == 1) 
		return cout << 1 << '\n', 0;
	get_ans();
	cout << res << '\n';
}


Measured memory_bytes: 57664
import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		int H1 = sc.nextInt();
		int M1 = sc.nextInt();
		int H2 = sc.nextInt();
		int M2 = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;

		if(M1<=M2){
			ans = ((H2-H1)*60)+(M2-M1);
			ans -= S;
		}else{
			ans = (H2-H1-1)*60;
			ans += (60+M2)-M1;
			ans -= S;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 35672
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

int cnt[100010];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	int K; cin >> K;
	memset(cnt, 0, sizeof(cnt));
	rep(i, 0, N) {
		int a, b; cin >> a >> b;
		cnt[a] += b;
	}
	int s = 0;
	rep(i, 0, 100010) {
		s += cnt[i];
		if (s >= K) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
def main():

    H, W = map(int, input().split())
    A = []
    white = 0
    h = []
    for i in range(H):
        A.append(list(input()))
        for j in range(W):
            if A[i][j] == '#':
                h.append([i, j])
            else:
                white += 1

    cnt = 0
    mv = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    while h and white > 0:
        temp = []
        cnt += 1
        for i, j in h:
            for di, dj in mv:
                i1, j1 = i+di, j+dj
                if 0<=i1<H and 0<=j1<W and A[i1][j1] == '.':
                    temp.append([i1, j1])
                    A[i1][j1] = '#'
                    white -= 1
        h = temp
    return cnt

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 166772
#include<bits/stdc++.h>
using namespace std;
int deg[1001];
int main()
{
	int i,x,y;
	for(i=1;i<=3;i++)
	{
		scanf("%d%d",&x,&y);
		deg[x]++;
		deg[y]++;
	}
	int sum=0;
	for(i=1;i<=4;i++)
		if(deg[i]==0||deg[i]>=3)
			sum++;
	if(sum==0)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main()
{	
	int n,k; cin>>n>>k;
	string a; cin>>a;
	int l=0,r=-1;
	int ans=0;
	int u=0;
	while(r<n)
	{
		if(r == n-1) break;
		if(u<k)
		{
			if(a[r+1] == '0'){
				int j=r+1;
				while(a[j] == '0' and j<n) j++;
				r=j-1;
				u++; 
			}
			else
			{
				int j=r+1;
				while(a[j] == '1' and j<n) j++;
				r=j-1;
			}
		}
		else if(u == k)
		{
			if(a[r+1] == '1'){
				int j=r+1;
				while(a[j] == '1' and j<n) j++;
				r=j-1;
			}
			else
			{
				if(a[l] == '1' and l<r) l++;
				else
				{
					int j=l;
					while(a[j] == '0' and l<r) j++;
					l=j;
					u--;
				}
			}
		}
		ans = max(ans,r-l+1);
	}

	cout<<ans;
}



















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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

int n;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (true) {
        cin >> n;
        if (n == 0) break;
        int cntw = 0;
        int cntb = 0;
        int pre = -1;
        vector<int> wr, br;
        rep(i, n) {
            int c;
            cin >> c;
            int wsize = wr.size();
            int bsize = br.size();
            if (i % 2 == 0) {
                if (pre != c) {
                    if (c == 1) wr.pb(i - 1);
                    else br.pb(i - 1);
                    pre = c;
                }
                if (c == 0) cntw++;
                else cntb++;
            }
            else {
                if (c == 0) {
                    if (pre != c) {
                        cntw += i - wr[wsize - 1];
                        cntb -= i - wr[wsize - 1] - 1;
                        pre = c;
                        if (wr[wsize - 1] == -1) br.pb(-1);
                        wr.pop_back();
                    }
                    else cntw++;
                }
                else {
                    if (pre != c) {
                        cntb += i - br[bsize - 1];
                        cntw -= i - br[bsize - 1] - 1;
                        pre = c;
                        if (br[bsize - 1] == -1) wr.pb(-1);
                        br.pop_back();
                    }
                    else cntb++;
                }
            }
        }
        cout << cntw << endl;
    }
}

Measured memory_bytes: 3084
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		if(n>=3200){
			System.out.println(s);
		}
		else{
			System.out.println("red");
		}
	}
}

Measured memory_bytes: 21844
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# 
# s = input()

H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
if H <= sum(A):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14016
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

/*

	Optimizer

*/
//#pragma GCC optimize("Ofast")

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

  int R,G;
  cin >> R >> G;
  cout << (G*2-R) << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

ll dp[51][51][2501];

int main() {
  int n, a;
  cin >> n >> a;
  vector<int> lx(n);
  for (int &x : lx) cin >> x;
  dp[0][0][0] = 1;
  for (int i = 0; i < n; ++i) { 
    // if (i > 3) break;
    int x = lx[i];
    for (int k = 0; k < n; ++k) { 
      for (int j = 0; j <= n*a; ++j) { 
        // if (dp[i][k][j] > 0) cerr << i << " " << k << " " << j << " " << dp[i][k][j] << endl;
        if (j + x <= n*a) { dp[i+1][k+1][j+x] += dp[i][k][j]; }
        dp[i+1][k][j] += dp[i][k][j];
      }
    }
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i) { 
    ans += dp[n][i][i*a];
  }
  cout << ans << endl;
}


Measured memory_bytes: 50048
#include<bits/stdc++.h>
using namespace std;
int main(){
  map<char,int>mp;
  string s;
  cin>>s;
  for(char c:s){
    mp[c]++;
  }
  for(auto p:mp){
    if(p.second%2!=0){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    
    string s,t;
    cin>>s>>t;
    cout<<t<<s<<endl;
    

    return 0;
}


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

int main() {
	
	long long N,i;
	cin>>N;
	
	set<string>S;
	string T;
	for(i=0;i<N;++i)
	{
		cin>>T;
		S.insert(T);
	}
	
	cout<<S.size()<<endl;
	return 0;
}

Measured memory_bytes: 19180
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n,t;cin>>n>>t;
int a=100453;
for(int i=0;i<n;i++){
int c,s;
  cin>>c>>s;
  if(s>t){continue;}
  a=min(a,c);
}
  if(a==100453){cout<<"TLE"<<endl;return 0;}
  cout<<a<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    ll n;cin>>n;
    ll a[n];
    rep(i,0,n)cin>>a[i];
    sort(a,a+n);
    ll c1=0,c2=0;
    rep(i,0,n){
        if(a[i]<=0)c1++;
        else c2++;
    }
    if(c1==n){
        ll ans=a[n-1];
        rep(i,0,n-1)ans+=-a[i];
        cout<<ans<<endl;
        ll now=a[n-1];
        rep(i,0,n-1){
            cout<<now<<" "<<a[i]<<endl;
            now+=-a[i];
        }
        return 0;
    }
    if(c2==n){
        ll ans=a[0];
        vector<pll> v;
        rep(i,1,n-1){
            v.push_back(make_pair(ans,a[i]));
            ans=ans-a[i];
        }
        cout<<a[n-1]-ans<<endl;
        v.push_back(make_pair(a[n-1],ans));
        rep(i,0,n-1)cout<<v[i].first<<" "<<v[i].second<<endl;
        return 0;
    }
    ll ans=a[0];
    vector<pll> v;
    
    rep(i,n-c2,n-1){
        v.push_back(make_pair(ans,a[i]));
        ans=ans-a[i];
    }
    v.push_back(make_pair(a[n-1],ans));
    ans=a[n-1]-ans;
    rep(i,1,c1){
        v.push_back(make_pair(ans,a[i]));
        ans=ans-a[i];
    }
    cout<<ans<<endl;
    rep(i,0,n-1)cout<<v[i].first<<" "<<v[i].second<<endl;
}


Measured memory_bytes: 4336
<?php
fscanf(STDIN,"%d",$n);
$l_li = explode(" ",trim(fgets(STDIN)));

sort($l_li);
$c = 0;
$end = count($l_li)-1;
for($i=0;$i<$n-2;$i++){
  for($j=$i+1;$j<$n;$j++){
    $ab = $l_li[$i]+$l_li[$j];
    $start = $j;
    $end = count($l_li);
    //echo "${j}\n";
    
    while($start+1<$end){
      $dis = $end-$start;
      $center = $start+(int)($dis/2);
      //echo $center."\n";
      //echo $start." ".$end."\n";
      if($l_li[$center]>=$ab){
        $end = $center;
      }else{
        $start = $center;
      }
      //echo $start." ".$end."\n";
      //$c++;
    }
    $end = count($l_li)-1;
    $c += $start-$j;
  }
}

echo $c;


Measured memory_bytes: 16308
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
cnt = [0]*N
for k,v in c.items():
    cnt[k-1] = v*(v-1)//2
num = sum(cnt)
ans = 0
for a in A:
   print(num-c[a]+1)

Measured memory_bytes: 89548
//Segment Tree
// RMQ
#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
// const int MAX_N = 1 << 17;
const int MAX_N = 200022;

int n, dat[2 * MAX_N - 1];

int init(int n_){
	n = 1;
	
	while(n < n_) n *= 2;
	
	for(int i = 0; i < 2 * n - 1; i++) dat[i] = INT_MAX;
	
	return n;
}

void update(int k, int a){
	k += n - 1;
	dat[k] = a;
	while(k > 0){
		k = (k - 1) / 2;
		dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}

int query(int a, int b, int k, int l, int r){
	if(r <= a || b <= l){
		return INT_MAX;
	}
	
	if(a <= l && r <= b){
		return dat[k];
	}else {
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2 );
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
}

int main(){
	int n, q, com, x, y;
	
	cin>>n>>q;
	
	n = init(n);
	
	for(int i = 0; i < q; i++){
		scanf("%d %d %d", &com, &x, &y);
		if(com){
			printf("%d\n",query(x,y+1,0,0,n));
		}else{
			update(x,y);
		}
	}
	
	return 0;
}


Measured memory_bytes: 4236
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) throws Exception {
        Main mo = new Main();
        
        ArrayList<String> dataSet = new ArrayList<String>();
        mo.inputDataSet(dataSet, "0");
        
        for(int i = 0;i < dataSet.size();i++){
            int n = Integer.parseInt(dataSet.get(i));
            RemoveUnluckyNumber run = new RemoveUnluckyNumber(n);
            run.showConvNum();
        }
    }
    
    public static void inputDataSet(ArrayList<String> dataSet, String terminal) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        while(true){
            String line = br.readLine();
            if(line.equals(terminal))break;
            dataSet.add(line);
        }
    }
}

class RemoveUnluckyNumber{
    private int n;
    
    public RemoveUnluckyNumber(int n){
        this.n = n;
    }
    
    public int extrOctalDigit(int decimalNum, int d){
        return (decimalNum >> 3 * (d - 1)) & 7;
    }
    
    public int singleDigitConv(int val){
        int convVal = val;
        
        if(convVal >= 4){
            convVal++;
            
            if(convVal >= 6){
                convVal++;
            }
        }
        
        return convVal;
    }
    
    public void showConvNum(){
        boolean printFlag = false;
        for(int i = 10;i >= 1;i--){
            int octalNumber = extrOctalDigit(n, i);
            if(octalNumber > 0){
                printFlag = true;
            }
            if(printFlag){
                System.out.print(singleDigitConv(octalNumber));
            }
        }
        
        if(!printFlag){
            System.out.print(0);
        }
        
        System.out.println();
    }
}



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

bool f(int n, int m, vector<int>& v) {
  while (n > 0) {
    if (v.back() < m) {
      return false;
    }
    if (v.back() >= m) {
      v.back() -= m;
      n -= m;
    }
    sort(v.begin(), v.end());
  }
  return true;
}

int main() {
  int h, w;
  cin >> h >> w;

  vector<int> alpha(26);
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      char c;
      cin >> c;
      alpha[c - 'a'] += 1;
    }
  }
  sort(alpha.begin(), alpha.end());

  int x = h % 2 == 0 ? 0 : w - 1;
  int y = w % 2 == 0 ? 0 : h - 1;
  int z = h * w - (h % 2 == 0 ? 0 : w) - (w % 2 == 0 ? 0 : h);

  bool ok = f(z, 4, alpha) && f(y, 2, alpha) && f(x, 2, alpha);
  if (ok) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
    char a[100]; 
    string b;
    int n;
    cin >> a;
    n = strlen(a);
    for (int i = 0; i < n; i++){
        b.push_back('x');
    }
    b.push_back('\n');
    cout << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    long long x,k,d; cin >> x >> k >> d;
    long long ax = abs(x);
    long long res = min(k, ax/d);
    long long ns = ax - d*res;
    if((k-res)%2)
        ns -= d;
    cout << abs(ns) << endl;
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define	pii pair<int,int>
#define vi vector<int>
#define all(x) x.begin(),x.end()
 
 
long long int solve(int n, int wt, int v[], int w[], int sum)
{
	long long int dp[sum+1];
  	for(int i=0;i<sum+1;i++)	dp[i]=INT_MAX;
  	dp[0] = 0;
	for(int i=0;i<n;i++)
		for(int j=sum-v[i];j>=0;j--)
			dp[j+v[i]] = min(dp[j+v[i]],dp[j]+w[i]);
	long long int mx = 0;	//long long 
	for(int j=0;j<=sum;j++)
		if(dp[j]<=wt)
			mx = max(mx,(long long)j);
	return mx;
}
 
int main()
{
	int n,wt;	cin>>n>>wt;
	int sum=0;
	int w[n],v[n];
	for(int i=0;i<n;i++)	cin>>w[i]>>v[i];
	for(int i=0;i<n;i++)	sum+=v[i];
	cout<<solve(n,wt,v,w,sum)<<endl;
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var acum = new long[N];

            acum[0] = A[0];
            for (var i = 1; i < N; i++)
                acum[i] = acum[i - 1] + A[i];

            var ans = 0L;
            ans += acum.Count(z => z == 0);
            Array.Sort(acum);

            var count = 0L;
            for (var i = 0; i < N; i++)
            {
                count++;
                if (i == N - 1 || acum[i] != acum[i + 1])
                {
                    ans += count * (count - 1) / 2;
                    count = 0;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 36320
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000


int main(){

	int K;
	cin>>K;
	
	vector<vector<pair<int,int>>> E(K,vector<pair<int,int>>());
	
	for(int i=0;i<K;i++){
		int a = (i*10)%K;
		E[i].emplace_back(a,0);
		int b = (i+1)%K;
		E[i].emplace_back(b,1);
	}
	
	vector<int> dis(K,Inf);
	dis[1] = 1;
	priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> Q;
	Q.emplace(1,1);
	
	while(Q.size()!=0){
		int D1 = Q.top().first;
		int from = Q.top().second;
		Q.pop();
		if(D1!=dis[from])continue;
		for(int i=0;i<E[from].size();i++){
			int to = E[from][i].first;
			int D2 = E[from][i].second;
			if(dis[to]>D1+D2){
				dis[to] = D1+D2;
				Q.emplace(dis[to],to);
			}
		}
	}
	
	cout<<dis[0]<<endl;
	
    return 0;
}



Measured memory_bytes: 6780
#include<stdio.h>

int partition(int *,int,int);

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

  k=partition(A,0,n);

  for(i=0;i<n;i++){
    if(i==0){
      if(i==k) printf("[%d]",A[i]);
      else printf("%d",A[i]);
    }  
    else if(i==k) printf(" [%d]",A[i]);
    else printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}

int partition(int *A,int o,int n){
  int x,i,j,k;
  x=A[n-1];
  i=o;

  for(j=o;j<n-1;j++){
    if(A[j]<=x){
      k = A[j];
      A[j] = A[i];
      A[i] = k;
      i++;
    }
  }

  k=A[i];
  A[i]=A[n-1];
  A[n-1]=k;

  return i;
}
    
  



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

int main() {
  int n, m;
  cin >> n >> m;
  if(n==1&&m==1) cout << 0 << endl;
  else if(n==1) cout << m*(m-1)/2 << endl;
  else if(m==1) cout << n*(n-1)/2 << endl;
  else cout << m*(m-1)/2 + n*(n-1)/2 << endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.rbegin(); itr != x.rend(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

using llong = long long int;

const static int MOD = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = 1LL << 31;
const static int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

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

  int a, b;
  cin >> a >> b;
  if (a <= 9 && b <= 9) cout << a*b << endl;
  else cout << -1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define endl "\n"
#define dbg(x) cout << #x << " = " << (x) << endl;
const ll MOD = 1000000007;
const ll INF = 1e18;

const int maxn = 1000;
int n, c;
int w[maxn];
int v[maxn];
ll dp[101][100001];

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("F:\\Scripts\\input","r",stdin);
    // freopen("F:\\Scripts\\output","w",stdout);
    // #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> c;
    for(int i = 0;i < n;i++) cin >> w[i] >> v[i];
    for(int i = 0;i < n;i++)
        for(int j = 0;j <= c;j++){
            if (w[i] <= j) dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
            else dp[i+1][j] = dp[i][j];
        }
    cout << dp[n][c];
    
}

Measured memory_bytes: 78464
#include<bits/stdc++.h>
using namespace std;
int main(){
    double x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    printf("%.8f\n",sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
    // cout << (float)sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)) << endl;
}


Measured memory_bytes: 3216
from sys import stdin
import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()
N, M = ds_in()
info_list = []
for _ in range(M):
    info_list.append(ds_in())
info_list = np.array(info_list)
ordered = np.argsort(info_list[:, 1])
pref_count = np.zeros(N)
ans_list = ['' for _ in range(M)]
for i in ordered:
    pref = info_list[i, 0]
    pref_count[pref - 1] += 1
    ans_list[i] = '%06d%06d' % (pref, pref_count[pref - 1])
for a in ans_list:
    print(a)


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

int selection_sort(int A[], int N) {
    int minj, cnt;

    cnt = 0;
    for (int i = 0; i < N; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj]) minj = j;
        }
        if (minj != i) {
            swap(A[i], A[minj]);
            cnt++;
        }
    }

    return cnt;
}

int main () {
    int N, A[100], cnt;
    cin >> N;

    for (int i = 0; i < N; i++) cin >> A[i];

    cnt = selection_sort(A, N);

    for (int i = 0; i < N; i++) {
        if (i) cout << ' ';
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
}



Measured memory_bytes: 3124
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B,X;
  std::cin >> A >> B >> X;
  if (A+B < X || A > X) {
    std::cout << "NO" << '\n';
  }else{
    std::cout << "YES" << '\n';
  }

  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()
tmp1 = 0
tmp1_list = []
tmp2 = 0
tmp2_list = []
cnt0 = 0
flag = 0

for i in range(n):
    if flag == 0:
        if s[i] == "0":
            cnt0 += 1
            flag = 1
            tmp1 += 1
            tmp2 += 1
        else:
            tmp1 += 1
            tmp2 += 1
    else:
        if s[i] == "1":
            tmp1_list.append(tmp1)
            tmp1 = 1
            tmp2 += 1
            flag = 0
        else:
            tmp1 += 1
            tmp2 += 1
    if cnt0 == k + 1:
        tmp2_list.append(tmp2 - 1)
        tmp2 -= tmp1_list.pop(0)
        cnt0 -= 1
    if i == n - 1:
        tmp2_list.append(tmp2)

print(max(tmp2_list))
        
        
        

Measured memory_bytes: 4892
import math
while(True):
  n = int(input())
  if n == 0:
    break;
  s = list(map(int, input().split()))
  ave = sum(s)/n
  dif = 0
  for i in range(n):
    dif = dif + (ave - s[i])*(ave - s[i])
  sd = math.sqrt(dif/n)
  print(round(sd, 8))


Measured memory_bytes: 5700
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N;
    scan(N);
    auto row = new int[](N);
    auto col = new int[](N);
    iota(N).each!(i => scan(row[i], col[i]));

    auto dp = new int[][](N + 1, N + 1);
    fillAll(dp, -1);

    int rec(int l, int r) {
        if (r - l == 1) {
            return 0;
        }
        if (dp[l][r] != -1) {
            return dp[l][r];
        }
        dp[l][r] = inf;
        foreach (i ; l + 1 .. r) {
            chmin(dp[l][r], rec(l, i) + rec(i, r) + row[l] * row[i] * col[r - 1]);
        }
        return dp[l][r];
    }

    auto ans = rec(0, N);
    writeln(ans);
}













void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}



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

using namespace std;
using LL = long long;
using P = pair<int,int>;

int main(){
	long double A, B;
	cin >> A >> B;
	LL ans=floor(A*B+0.005);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3756
from collections import deque

n = int(input())
a = [0] + list(deque(map(int, input().split())) for _ in range(n))
cnt, cur, days = 0, [0] * (n + 1), [0] * (n + 1)
q = deque(list(range(1, n + 1)))
while q:
	x = q.popleft()
	if not a[x]:
		continue
	y = a[x].popleft()
	if cur[y] == x:
		cnt += 1
		days[x] = days[y] = max(days[x], days[y]) + 1
		cur[x], cur[y] = 0, 0
		q.append(x)
		q.append(y)
	else:
		cur[x] = y
res = max(days) if cnt == n * (n - 1) // 2 else -1
print(res)

Measured memory_bytes: 79984
N=int(input())
A=list(map(int,input().split()))
count=0
shift=True
while True:
    for i in range(0,N):
        if A[i]%2==1:
            shift=False
            break
    if shift==True:
        for i in range(0,N):
            A[i]=A[i]/2
        count+=1
    else:
        break
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> v(n+1);
    vector<pair<int,int>> city(m);
    rep(i,m){
       int x,y;
       cin >> x >> y;
       pair<int,int> w=make_pair(x,y);
       city[i]=w;
       pair<int,int> p=make_pair(y,x);
       v[x].push_back(y);
    }
    for (int i=1;i<=n;i++){
       sort(v[i].begin(),v[i].end());
    }
    rep(i,m){
       printf("%06d",city[i].first);
       printf("%06d\n",int(lower_bound(v[city[i].first].begin(),
                                       v[city[i].first].end(),city[i].second)-v[city[i].first].begin())+1);
    }

    return 0;
}

Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pii pair<int,int>
#define pb push_back
#define INF INT_MAX
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  (B) <= (A) && (A) <= (C)
#define AIN(A, B, C) assert(IN(A, B, C))

int main() {
     //#ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
     //#endif
     ios; 
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a==0)cout<<1;
    if(b==0)cout<<2;
    if(c==0)cout<<3;
    if(d==0)cout<<4;
    if(e==0)cout<<5; 

        
}


Measured memory_bytes: 3648
import sys
X,Y = map(int,input().split())

if not ( 1 <= X <= 100 and 1 <= Y <= 100 ): sys.exit()

for I in range(101):
    for J in range(101):
        if (I*2 + J*4) == Y and I+J == X:
            print('Yes')
            sys.exit()
print('No')

Measured memory_bytes: 9184
a,b=map(int,input().split())

def NonRecursiveGcd(x,y):
 
    while(y):
        x , y = y , x % y
    return x 
def computeLcmWithNonRecursiveGcd(x,y):
    
    lcm = (x*y)//NonRecursiveGcd(x,y)
    
    return lcm  
print(computeLcmWithNonRecursiveGcd(a,b))

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>
 
using namespace std;
 
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr = ds.begin(); itr != ds.end(); ++itr)
#define mp make_pair
#define INF 2000000000
#define INFL 2000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;

int main(void){
	int a,b;
	cin>>a>>b;
	cout<<(a+b)%24<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;




void main() {
    string o, e;
    scan(o);
    scan(e);

    string ans;
    int i;

    while (!o.empty || !e.empty) {
        if (i % 2 == 0) {
            ans ~= o.front;
            o.popFront();
        }
        else {
            ans ~= e.front;
            e.popFront();
        }
        i++;
    }

    writeln(ans);
}


Measured memory_bytes: 256
from collections import Counter


def main():
    N = int(input()) # 5人
    An = list(map(int, input().split(' '))) # A2, A3,...
    
    # N = 10
    # An = [1,1, 1, 1, 1, 1, 1, 1, 1]
    
    # out = [0] *
    
    an = Counter(An)
    for n in range(1, N+1):  
        print(an[n])
            


    
main()


Measured memory_bytes: 112264
use proconio::{fastout, input};

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        s: String,
    }

    let ans: isize = s
        .chars()
        .map(|c| match c {
            '+' => 1,
            '-' => -1,
            _ => 0,
        })
        .sum();
    println!("{}", ans);
}


Measured memory_bytes: 2160
n, k = map(int, input().split())
sunuke_set = set(i for i in range(1, n + 1))

for i in range(k):
    d = int(input())
    sunuke_tuple = tuple(map(int, input().split()))
    for sunuke in sunuke_tuple:
        sunuke_set.discard(sunuke)

print(len(sunuke_set))


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

int main()
{
    string s,t;
    cin>>s>>t;
    
    int ans=0;
    
    for(int i=0;i<s.length();i++)
    {
        if(s[i] != t[i])
        {
            ans++;
        }
    }
    
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 3916
n = int(input())
A = [0] * n
i = 7%n
import sys
if i==0:
    print(1)
    sys.exit()

ans = 1
while A[i] == 0:
    A[i] = 1
    i = (i*10+7)%n
    ans += 1
    if i == 0:
        print(ans)
        sys.exit()

print(-1)

Measured memory_bytes: 71204
#define REP(i, n) for(int i = 0;i < n;i++)
#define INF 2e9
#define ll long long
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ALL(v) v.begin(), v.end()

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int dx=tx-sx, dy=ty-sy;
    REP(i, dy) cout << "U";
    REP(i, dx) cout << "R";
    REP(i, dy) cout << "D";
    REP(i, dx) cout << "L";
    cout << "L";
    REP(i, dy+1) cout << "U";
    REP(i, dx+1) cout << "R";
    cout << "DR";
    REP(i, dy+1) cout << "D";
    REP(i, dx+1) cout << "L";
    cout << "U\n";
}



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

using namespace std;

int main() {
    int n, x;
    int a[110]; 
    int ans = 0;
    long int sum = 0;
    long int s = 0;

    for (int i = 0; i < 110; i++){
        a[i] = 0;
    }
    cin >> n >> x;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    if (sum == x) {
        cout << n << endl;
    } else{ 
        sort(a, a+n);

        for (int i = 0; i < n; i++){
            if (s+a[i] <= x){
                s += a[i];
                ans++;      
            }
            else{
                break;
            } 
        }

        if (sum < x){
            ans--;
        }

        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

int main(){
  int r; cin >> r;
  cout << 2*r*(3.14159265) <<endl;
}


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

const int mod = 1e9 + 7, mxN = 1e5 + 5, mxC = 2;
int N;
vector<int> adj[mxN];
ll dp[mxN][mxC];

ll rec(int v, int p, int pcol) {
	if (dp[v][pcol] != -1)
		return dp[v][pcol];
	ll tot = 0, ways = 1;
	if (pcol == 0) {
		for (auto it : adj[v]) {
			if (it != p) {
				ways = (ways * rec(it, v, 1)) % mod;
			}
		}
		tot = ways;
	}
	ways = 1;
	for (auto it : adj[v]) {
		if (it != p) {
			ways = (ways * rec(it, v, 0)) % mod;
		}
	}
	tot = (tot + ways) % mod;
	return dp[v][pcol] = tot;
}

int main() {
	ios_base::sync_with_stdio(false);

	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		int x, y;
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	memset(dp, -1, sizeof(dp));
	ll answer = rec(1, 0, 0);
	cout << answer;

	return 0;
}

Measured memory_bytes: 17496