akhauriyash/Code-Regression huggingface dataset:
'use strict'

function main(s) {  
  
  // 入力処理
  const input = s.split('\n');
  let price = Number(input[0].split(' ')[0]);
  const hateNums = input[1].split(' ');

  // 嫌いな数字が含まれなくなるまでインクリメント
  while(hasHateNumber(price, hateNums)) {
    price += 1;
  }

  // 出力
  console.log(price);
}

function hasHateNumber(num, hateNums) {
  let hasHateNum = false;
  
  String(num).split('').forEach((x) => {
    if(hateNums.includes(x)) {
      hasHateNum = true;
    };
  })

  return hasHateNum;
}

// Array.prototype.includesが使えないため、互換コードを用意
if (!Array.prototype.includes) {
  Object.defineProperty(Array.prototype, 'includes', {
    value: function(searchElement, fromIndex) {

      if (this == null) {
        throw new TypeError('"this" is null or not defined');
      }

      // 1. Let O be ? ToObject(this value).
      var o = Object(this);

      // 2. Let len be ? ToLength(? Get(O, "length")).
      var len = o.length >>> 0;

      // 3. If len is 0, return false.
      if (len === 0) {
        return false;
      }

      // 4. Let n be ? ToInteger(fromIndex).
      //    (If fromIndex is undefined, this step produces the value 0.)
      var n = fromIndex | 0;

      // 5. If n ≥ 0, then
      //  a. Let k be n.
      // 6. Else n < 0,
      //  a. Let k be len + n.
      //  b. If k < 0, let k be 0.
      var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);

      function sameValueZero(x, y) {
        return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
      }

      // 7. Repeat, while k < len
      while (k < len) {
        // a. Let elementK be the result of ? Get(O, ! ToString(k)).
        // b. If SameValueZero(searchElement, elementK) is true, return true.
        if (sameValueZero(o[k], searchElement)) {
          return true;
        }
        // c. Increase k by 1. 
        k++;
      }

      // 8. Return false
      return false;
    }
  });
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 13236
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 998244353
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 100000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    vector<vector<int>>v(n);
    while(m--){
        int x,y;
        cin>>x>>y;
        x--;y--;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    int ans=0;
    for(int i=0;i<n;i++){
        bool b=true;
        for(auto j:v[i]){
            if(a[j]>=a[i])b=false;
        }
        if(b)ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 9796
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    a, b, c = LI()
    if a + b + c >= 22:
        print("bust")
    else:
        print("win")
    return


# B
def B():
    s = S()
    ans = 0
    for i in range(len(s) // 2):
        if s[i] != s[-i - 1]:
            ans += 1
    print(ans)
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    B()
    return


# Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 38384
#include <stdio.h>

int main()
{
	int i;
	char s[101];
	scanf("%s", s);
	for (i = 0; s[i] != 0; i++);
	printf("%c%d%c\n", s[0], i - 2, s[i-1]);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long long sum1=0,sum2=0,sum3=0,sum4=0;
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	sum1=a*c;
	sum2=a*d;
	sum3=b*c;
	sum4=b*d;
	long long maxn=max(max(max(sum1,sum2),sum3),sum4);
	cout<<maxn<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
 
int main(void)
{
    int student;
    int num;
    int i;
 
    while (scanf("%d", &num) != EOF){
        student = 1;
 
        for (i = 1; i < num; ++i){
            if (student < 39){
                student++;
            }
            else if (student == 39){
                student = 1;
            }
        }
         
        printf("3C%02d\n", student);
    }
}

Measured memory_bytes: 1036
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

char field[110][110];

int main() {
	int N, M, D;
	cin >> N >> M >> D;

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> field[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			if (field[i][j] != '#') {
				int n = j, m = i,cnt = 0;
				while (1) {
					if (n + 1 <= M) {
						if (field[i][n] != '#') {
							n++;
							cnt++;
						}
						else break;
					}
					else
						break;
					if (cnt >= D) {
						ans++;
						break;
					}
				}
				cnt = 0;
				while (1) {
					if (m + 1 <= N) {
						if (field[m][j] != '#') {
							m++;
							cnt++;
						}
						else break;
					}
					else
						break;
					if(cnt >= D) {
						ans++;
						break;
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>

using namespace std;

int main(){
    string colors;
    cin >> colors;
    int count = 0;
    for(int i=0; i<colors.length(); ++i){
        if(colors[i]==i%2+'0') ++count;
    }
    cout << min(count, (int)colors.length()-count) << endl;
}


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

int min(int a, int b)
{
    return (b > a ? a : b);
}

int main(void)
{
    int i, j, k;
    int n;
    int div[10001];
    static int dp[2][5001][2];
    int lim;
    
    scanf("%d", &n);
    
    for (i = 1; i <= n - 1; i++){
        scanf("%d", &div[i]);
    }
    memset(dp, 1, sizeof(dp));
    dp[0][0][0] = dp[0][0][1] = 0;
    
    lim = n / 2;
    
    for (i = 0; i <= lim; i++){
        for (j = 0; j <= lim; j++){
            if (i > 0){
                dp[i & 1][j][0] = dp[(i - 1) & 1][j][0];
                dp[i & 1][j][1] = dp[(i - 1) & 1][j][0] + div[i + j];
            }
            if (j > 0){
                dp[i & 1][j][0] = min(dp[i & 1][j][0], dp[i & 1][j - 1][1] + div[i + j]);
                dp[i & 1][j][1] = min(dp[i & 1][j][1], dp[i & 1][j - 1][1]);
            }
        }
    }
    
    printf("%d\n", min(dp[0][lim][0], dp[0][lim][1]));
    
    return (0);
}

Measured memory_bytes: 484
#include<bits/stdc++.h>
using namespace std;
//#define ull unsigned  long  long
#define int long long int
#define lld long double
#define endl "\n"
#define S second
#define F first
#define pir      pair<int,int>
#define vtr      vector<int>
#define mpp      map<int,int>
#define pb       push_back
#define popb     pop_back()
#define mk       make_pair
#define stc      set<char>
#define st       set<int>
#define stk      stack<int>
#define ctn      continue
#define MOD      1000000007
#define fr(i,a,b)   for(int i=a;i<b;i++)
#define rfr(i,a,b)  for(int i=a-1;i>=b;i--)
#define must        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

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

int myfun(int x,int y)
{
    return x*y;
}
void primeFactors(int n)
{
    while (n%2 == 0)
    {
        cout<<2<<endl;
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            cout<<i<<endl;
            n = n/i;
        }
    }
    if (n > 2)
        cout<<n<<endl;
}

void fillPrefixSum(int arr[], int N, int prefixSum[])
{
    prefixSum[0] = arr[0];

    for (int i = 1; i < N; i++)
        prefixSum[i] = prefixSum[i-1] + arr[i];
}

int factorial(int n)
{
    return (n==1 || n==0) ? 1: n * factorial(n - 1);
}

int power(int x,  int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;
    }
    return res;
}

int max(int a, int b) { return (a > b) ? a : b; }

// Returns the maximum value that
// can be put in a knapsack of capacity W
int knapSack(int W, int wt[], int val[], int n)
{

    // Base Case
    if (n == 0 || W == 0)
        return 0;

    // If weight of the nth item is more
    // than Knapsack capacity W, then
    // this item cannot be included
    // in the optimal solution
    if (wt[n] > W)
        return knapSack(W, wt, val, n - 1);

    // Return the maximum of two cases:
    // (1) nth item included
    // (2) not included
    else
        return max(
            val[n] + knapSack(W - wt[n],
                                    wt, val, n - 1),
            knapSack(W, wt, val, n - 1));
}



void solve()
{
    double d,t,s;
    cin>>d>>t>>s;
    if((d/s)<=t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



signed main()
{
	must;
    int tt=1;
    //cin >> tt;
	while(tt--)solve();
	return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define INF 0x3f3f3f3f

LL slv(LL x,LL y,LL s)
{
    LL X = x/2,Y = y/2;
    return min (
        max( max(abs(X*y-s),abs((x-X)*y-s)), abs(X*y-(x-X)*y) ),
        max( max(abs(x*Y-s),abs((y-Y)*x-s)), abs(Y*x-(y-Y)*x) )
    );
}

int main()
{
    LL h,w;
    cin>>h>>w;
    LL ans = INF;
    for (int i=1;i<=h;i++)
        ans = min (ans,slv(h-i,w,i*w));
    for (int i=1;i<=w;i++)
        ans = min (ans, slv(w-i,h,i*h));
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N,Q = tuple(map(int,input().split()))

s = input()

Query = []
for i in range(Q):
    Query.append(input().split())
#A L
#B L
#B R
#A R



left,right = 0,N-1

## 最終的に生き残っているのをleftとrightにする
## 

for ch,way in reversed(Query):
    #print(left,right,ch,way,s[left],s[right])
    if way == "L":
        if ch == s[left]:
            left += 1
        if right < N-1 and ch == s[right+1]:
            right = min(right + 1,N-1)
        #print("L",left,right,ch,way,s[left],s[right])
    else:
        if left > 0 and ch == s[left-1] :
            left = max(left -1,0)
        if ch == s[right]:
            right -= 1
        #print("R",left,right,ch,way,s[left],s[right])
print(max(0,right-left+1))

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

int main() {
  int k;
  cin>>k;
  queue<long long>lunlun;
  for(int i=1;i<=9;i++) lunlun.push(i);
  long long ans;
  for(int i=0;i<k;i++){
    ans=lunlun.front();
    if(ans%10==0){
      lunlun.push(ans*10);
      lunlun.push(ans*10+1);
    }
    else if(ans%10==9){
      lunlun.push(ans*10+8);
      lunlun.push(ans*10+9);
    }
    else{
      int a=ans%10;
      lunlun.push(ans*10+a-1);
      lunlun.push(ans*10+a);
      lunlun.push(ans*10+a+1);
    }
    lunlun.pop();
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;

int main() {
    int H, N;
    cin >> H >> N;
    vector<long long> A(N);
    vector<long long> B(N);
    rep(i, 0, N) { cin >> A[i] >> B[i]; }
    vector<long long> dp(H + 1, INF);
    dp[0] = 0;
    rep(i, 1, H + 1) {
        rep(n, 0, N) {
            if(i - A[n] > 0) {
                dp[i] = min(dp[i], dp[i - A[n]] + B[n]);
            } else {
                dp[i] = min(dp[i], B[n]);
            }
        }
      //  cout << dp[i] << endl;
    }
    cout << dp[H] << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int n;
	cin >> n;
	vector<int> a(3 * n);
	rep (i, 3 * n) cin >> a[i];

	sort(rng(a));

	ll ans = 0;
	rep (i, n) ans += a[n + i * 2];

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

Measured memory_bytes: 1408
#include "bits/stdc++.h"
 
#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9
 
const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };
 
 
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	if (c >= a&&c <= b)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


int main() {
  int N,M,X,C;
  cin >> N >> M >> X;
  vector<int> cost(N);
  vector<vector<int>> A(N,vector<int>(M));
  rep(i,N){
    cin >> C;
    cost[i]=C;
    rep(j,M) cin >> A[i][j];
  }

  int ans=INT_MAX,tmp;
  for (int i=0;i<1<<N;i++){
    tmp = 0;
    vector<int> tmpv(M,0);
    rep(j,N) {
      if (i>>j&1) {
        tmp+=cost[j];
        rep(k,M) {
          tmpv[k] += A[j][k];
        }
      }
    }
    rep(k,M) {
      if (tmpv[k]<X) break;
      else if (k==M-1) {
        chmin(ans, tmp);
      }
    }
  }
  if (ans==INT_MAX) ans=-1;
  cout << ans << endl;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

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

  ll a, b, c, k; cin >> a >> b >> c >> k;

  ll sgn = (k % 2 ? -1 : 1);
  
  ll ans = (a - b) * sgn;
  cout << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int s,i,j,k,a,b,n;
    scanf("%d%d",&a,&b);
    s=(a*(a-1))/2;
    i=(b*(b-1))/2;
    j=s+i;
    printf("%d\n",j);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

int main() {
    std::string S;
    std::cin >> S;
    
    int ans = 0;
    
    auto itr = S.begin();
    
    while (itr+1 != S.end() && itr != S.end()) {
        if (*itr != *(itr+1)) {
            itr = S.erase(itr);
            itr = S.erase(itr);
            if (itr != S.begin()) itr--;
            ans += 2;
        } else {
            itr++;
        }
    }
    
    std::cout << ans << std::endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void) {
	int t, s, f, n = 0, z, i;
	while (1) {
		scanf("%d", &t);
		if (t == 0)break;
		z = 0;
		scanf("%d", &n);
		for (i = 0;i < n;i++) {
			scanf("%d %d", &s, &f);
			z += f - s;
		}
		if (t<=z) {
			printf("OK\n");
		}
		else {
			printf("%d\n", t - z);
		}
	}
	return 0;
}

Measured memory_bytes: 612
height, width, k = map(int, input().split())

ans = [[0] * (width + 2) for i in range(height + 1)]
start_w = 1
end_w = width
start_h = 0
ans[start_h][start_w] = 1
search_range = start_w + 1 if end_w > 1 else 1
f = [0] * (width + 2)
f[0], f[1], f[2] = 1, 1, 1


def det_unused(n, m=0):
    front = n - (start_w + 1)
    rear = end_w - (n + 1)

    if m == -1:
        front -= 1
    elif m == 1:
        rear -= 1

    ret = int(calc(front) * calc(rear))
    return ret


def calc(n):
    if n < 1:
        return 1
    return calc_f(n+2)


def calc_f(n):
    if f[n] == 0:
        f[n] = calc_f(n - 1) + calc_f(n - 2)
    return f[n]


for h in range(1, height + 1):
    for w in range(1, search_range + 1):
        prev_ans = ans[h - 1]
        ans[h][w] = prev_ans[w] * det_unused(w) + prev_ans[w - 1] * det_unused(w, -1) + prev_ans[w + 1] * det_unused(w, 1)
        ans[h][w] %= 1000000007
    if search_range < end_w:
        search_range += 1

print(ans[height][k])

Measured memory_bytes: 3064
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

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

	vector<int> L;
	for (int i = 0; i < N; i++) {
		int l;
		cin >> l;
		L.push_back(l);
	}

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

	int count = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < i; ++j) {
			for (int k = 0; k < j; ++k) {
				if (L[i] != L[j] && L[j] != L[k] && L[k] + L[j] > L[i]) {
					count++;
				}
			}
		}
	}
	cout << count << endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef long long ll;
typedef pair<int,int> pint;
const ll mod= 1e9+7;
const int inf=1e9+7;
const ll  longinf = 1LL<<60;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int pos[20];

int main(){
  int n;
  cin>>n;
  int a[n][20];
  rep(i,n){
    int x;cin>>x;
    rep(j,20){
      a[i][j]=x%2;
      x/=2;
      }
    }
  ll left=0,right=-1,ans=0;
  int ma=0;
  while(left<n){
    ma=0;
    rep(i,20)ma=max(ma,pos[i]);
    if(ma<=1){
      ans+=right-left+1;
      right++;
      rep(i,20)pos[i]+=a[right][i];
      }
    else{
      rep(i,20)pos[i]-=a[left][i];
      left++;
      }
    }
  ans+=right-left;
  cout<<ans<<endl;
  return 0;
  }

Measured memory_bytes: 15872
/* modf example */
#include <bits/stdc++.h>
using namespace std;

int main ()
{
  long double param, fractpart, intpart;
  long double a,b;
  cin >> a >> b;
  param = a*b;
  fractpart = modf (param , &intpart);
  cout << (long long)intpart << "\n";
  return 0;
}

Measured memory_bytes: 3756
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;


public class Main{
	static final long MOD = 1000000007;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long a = sc.nextInt();
		long b = sc.nextInt();
		long g = gcd(a, b);
		System.out.println(a * b / g);
	}
	static long gcd(long a, long b) {
	    if (b == 0) {
	        return a;
	    }
	    return gcd(b, a % b);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 25044
n = int(input())
s = input()
a = (len(s)//2)
count = 0
if n % 2 == 0:
  for i in range (a):
    if s[i] == s[a + i]:
      count += 1
  if count == n/2:
    print('Yes')
  else:
    print('No')
else: 
  print('No')


Measured memory_bytes: 9048
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
#define ll long long
int n;
ll t[111111];
ll sum=0;

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>t[i];
	for(int i=1;i<=n+1;i++)sum+=abs(t[i]-t[i-1]);
	

	for(int i=1;i<=n;i++){
		cout<<sum-abs(t[i]-t[i-1])-abs(t[i]-t[i+1])+abs(t[i-1]-t[i+1])<<endl;
	}
	return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
 
int main(){
    int L;
    vector<vector<int>> ans;
    int r=1,i=1;

    cin >> L;
    
    while(2*r<=L){
        ans.push_back({i,i+1,0});
        ans.push_back({i,i+1,r});
        ++i;
        r*=2;
    }
 
    while(r!=L){
        int j=log2(L-r);
        ans.push_back({j+1,i,r});
        r+=pow(2,j);
    }
    
    cout << i << " " << ans.size() << endl;
    for(int i=0;i<ans.size();++i) {
        cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 640
h,w,a,b = map(int,input().split())
mod = 10**9+7

MAX = 2*10**5
fact = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact[i] = (fact[i-1]*i) % mod

inv = [1]*(MAX+1)
for i in range(2, MAX+1):
    inv[i] = inv[mod % i]*(mod-mod//i) % mod

fact_inv = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod
  
ans = 0
for k in range(b+1,w+1):
  ans += comb(k+h-a-2,h-a-1)*comb(w-k+a-1,a-1)%mod
  ans %= mod
print(ans)

Measured memory_bytes: 79764
/**
*    created: 12.06.2020 18:32:23
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<pair<int,int>> mp(n);
    rep(i,n) {
        //はじめがlimit, あとが所要時間
        cin >> mp[i].second >> mp[i].first;
    }
    sort(mp.begin(),mp.end());
    int sum = 0;
    bool ok = true;
    rep(i,n) {
        sum += mp[i].second;
        if (sum > mp[i].first) {
            ok = false;
            break;
        }
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)

const ll MOD = 1000000007;

using namespace std;

int n[1001] = {};

void count(int i)
{
	while (i != 1)
	{
		FOR(j, i + 1, 2)
		{
			if (i%j == 0)
			{
				i /= j;
				n[j]++;
				break;
			}
		}
	}
	return;
}

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

	FOR(i, N + 1, 1)
	{
		count(i);
	}

	ll ans = 1;
	FOR(i, N + 1, 1)
	{
		ans = (ans*(n[i] + 1)) % MOD;
	}

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

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-5;

double q;
double prev;

template<typename T> T add(T x, T y){ if(abs(x+y) < EPS*q*(abs(x)+abs(y))) return 0; return x + y; }
template<typename T> inline bool semieq(T x, T y){ return abs(x - y) < EPS*q; }
template<typename T> inline bool semige(T x, T y){ return x - y > -EPS; }
template<typename T> inline bool semile(T x, T y){ return y - x > -EPS; }

inline double next(double x, double q){ return x - ((x * x * x - q) / ( 3 * x * x)); }

int main()
{
  while((cin >> q) && q > 0.0){
    double res = q / 2.0;
    while(!semieq(res*res*res, q)) res = next(res, q);
    printf("%.15f\n", res);
  }

  return 0;
}

Measured memory_bytes: 1236
object Main extends App {
  val sc = new java.util.Scanner(System.in);
  val n = sc.nextInt();
  val ds = Array.fill(n)((sc.nextInt(), sc.nextInt()));
  val ds2 = ds.map { case (a, b) => a == b }
  var c1: Int = 0;
  var c2: Int = 0;
  (0 until n).foreach { i =>
    if (ds2(i)) {
      c2 += 1;
      if (c1 < c2) {
        c1 = c2;
      }
    } else {
      c2 = 0;
    }
  }
  println(if (c1 >= 3) "Yes" else "No");
}

Measured memory_bytes: 55448
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main() {

    int r,g,b; cin >>r>>g>>b;
    int res =  r * 100 + g * 10 + b;

    if (res % 4 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    } 
    return 0;
}


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


#define ll long long


//gcdやり直す

void swap (int *x, int *y) {
  int temp;    

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




/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

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

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

  return j;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}





/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  int n;
  scanf("%d",&n);
  /*


  C=n*(n+1)/2とおく．

  n頂点からなる完全グラフを考えると，
  頂点iにおける隣接頂点の和は(C-i)である．
  ここで次の補題を考える．

  Lemma:頂点s,t(1<=s,t<=n,s!=t)をつなぐ辺を取り除いたとき，
  それぞれの隣接頂点の和は等しくなる．

  Proof:s,t,の隣接頂点の和はそれぞれ(C-s),(C-t)である．
  ここで，辺を取り除くとそれぞれの隣接頂点の和は(C-s-t),(C-t-s)となり等しい．
  ->(C-(s+t))

  まずnが偶数の時の考察をする．
  (s,t)=(1,n),(2,n-1),(3,n-2)...(n/2,n/2+1)というn/2個のペアを考える．
  このようにペアをとると，各ペアの隣接頂点の和は(C-(n+1))で等しくなる．
  よって，nが偶数の時は完全グラフからこれらの辺を除いたものを構成すればよい．

  次にnが奇数の時の考察をする．
  いま1~nがそれぞれ書かれたn頂点のグラフGを考えているが，これに頂点0を追加した
  (n+1)頂点からなるグラフG'を考える．するとグラフG'の各頂点における隣接頂点の和は
  変化しないことがわかる．そこで，先ほど同様(s,t)=(0,n),(1,n-1),...((n-1)/2,(n+1)/2)
  というペアを考えると，各ペアの隣接頂点の和は(C-n)で等しくなる．
  よってnが奇数の時は完全グラフG'からこれらの辺と頂点0から出る辺を除いたものを構成すればよい．

  最後に
  ・完全グラフの辺の本数=n*(n+1)/2
  ・取り除く本数はn/2の切り捨て
  ということがわかるので，構成するために必要な辺の本数は
  n*(n+1)/2-n/2であることがわかる．
  (下の実装では完全グラフの辺の数=(n角形の対角線の数)+(n角形の辺の数)という形で実装しています)


  実際の構成方法は以下のコードの通りで，計算量はO(n^2)で十分高速である．


  */
  //(n-3)*n/2->n角形の対角線の数
  //n->n角形の辺の数

  int ans=(n-3)*n/2+n;//完全グラフの辺の数
  ans-=n/2;//引く数

  printf("%d\n",ans);//答をまず出力

  //n is even->(s,t)=s+t=n+1だったらまずい
  //n is odd->(s,t)=s+t=nだったらまずい
  for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      if(i+j==n+1 && n%2==0){
        continue;
      }
      if(i+j==n && n%2==1){
        continue;
      }

      printf("%d %d\n",i,j);
    }
  }
}

Measured memory_bytes: 1720
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
     
using namespace std;
     
typedef long long ll;
typedef pair<int, int> pii;
     
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
     
mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

struct R{
    string city;
    int score;
    int id;
    bool operator<(const R &B) const {
        if(city == B.city)
            return score > B.score;
        else
            return city < B.city;
    }
};

int main(){
    fastIO;
    int n;
    cin >> n;
    R t[n];
    for(int i = 0 ; i < n ; i ++ ){
        cin >> t[i].city >> t[i].score;
        t[i].id = i + 1;
    }
    sort(t,t + n);
    for(int i = 0 ; i < n; i ++ )
        cout << t[i].id << "\n" ;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int mp[2][100];
int main() {
  int n;
  cin >> n;
  rep(k,2)rep(i,n){
    cin >>mp[k][i];
  }
  int ans = 0;
  rep(i,n){
    int cnt = 0;
    rep(j,i+1) cnt+=mp[0][j];
    srep(k,i,n)cnt+=mp[1][k];
    maxs(ans,cnt);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
while True:
    n=int(input())
    if n==0:
        break
    lst=[float(s) for s in input().split()]
    m=sum(lst)/n
    lst1=[]
    for i in range(n):
        x=(lst[i]-m)**2
        lst1.append(x)
    print(f'{(sum(lst1)/n)**(1/2):10.8f}')


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

int main(){
  ll n,k;
  cin >>n >>k;
  n %= k;
  cout << min(n, k-n) << endl;
  return 0;
}


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

using namespace std;

int main(void)
{
    int T, X;
    cin >> T >> X;

    cout << double(T) / double(X) << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
typedef long long int LL;
using namespace std;
#define INF (1LL << 60)
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,k,n) for(int i=(k);(i)<(n);(i)++)
#define REP(i,n) for(int i = 0;(i)<(n);(i)++)
#define REPR(i,n) for(int i = n; i >= 0; i--)
#define F first
#define S second

vector<LL> a;	//a[i]　レベルiバーガーの厚さ
vector<LL> p;	//p[i]　レベルiバーガーのパティの総数

LL f(int n, LL x) {	//レベルnバーガーの下からｘ層に含まれるパティの枚数
	if (n == 0) {
		return 1;
	}
	if (x == 1) {
		return 0;
	}
	if (1 < x && x < 2 + a[n - 1]) {
		return f(n - 1, x - 1);
	}
	if (x == 2 + a[n - 1]) {
		return p[n - 1] + 1;
	}
	if (2 + a[n - 1] < x && x < 3 + a[n - 1] * 2) {
		return f(n - 1, x - (a[n - 1] + 2)) + p[n - 1] + 1;
	}
	if (x == 3 + a[n - 1] * 2) {
		return 2 * p[n - 1] + 1;
	}
}

int main() {
	LL n, x;
	cin >> n >> x;

	a.push_back(1);
	p.push_back(1);
	REP(i, n) {
		a.push_back(a[i] * 2 + 3);
		p.push_back(p[i] * 2 + 1);
	}

	cout << f(n, x) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<queue>
#include<vector>
#include<map>
#include<string>
using namespace std;
#define FOR(i,a,b) for(int i = (a);i < (b);++i)
typedef long long ll;
int main(){
	int a,b,c; cin >> a >> b >> c;
  if(a == b && b== c){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}

int main(){
	int a, b;
	cin >> a >> b;
	int ans = max(0, a-2*b);
	cout << ans << endl;
}


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

using namespace std;

const int N = 1e5 + 20;

int n, k, ans = 0;

int a[N];

int main () {
	cin >> n >> k;
	for (int i = 1;i <= n;i ++) {
		cin >> a[i];
		if (a[i] >= k)ans ++;
	}
	cout << ans;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  int a[n];
  vector<vector<int>> d(n, vector<int>(n, 0));
  rep(i, n) a[i] = i;
  rep(i, m){
    int b, c;
    cin >> b >> c;
    b--, c--;
    d[b][c] = 1, d[c][b] = 1;
  }
  int ans = 0;
  do {
    bool can = true;
    rep(i, n-1){
      if(!d[a[i]][a[i+1]]) can = false;
    }
    if(can) ans++;
  } while(next_permutation(a+1, a+n));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  set<char> se;
  REP(i,s.size()) se.insert(s[i]);
  cout << (s.size() == se.size() ? "yes" : "no") << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int S, h, m, s;

	scanf("%d", &S);

	h = S / 3600 ;
	m =(S - h * 3600) / 60;
	s =(S - h * 3600) % 60;

	printf("%d:%d:%d\n", h, m, s);


	return 0;

}

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

using namespace std;

int main()
{
    int n, m, x;
    cin >> n >> m >> x;

    vector<int> a(m);
    for (int i = 0; i < m; i++)
    {
        cin >> a.at(i);
    }

    int cost_forward = 0;
    for (int i = x; i <= n - 1; i++)
    {
        for (int j = 0; j < m;j++)
        {
            if (i + 1 == a.at(j))
            {
                cost_forward++;
            }
        }
    }

    int cost_back = 0;
    for (int i = x; 1 <= i; i--)
    {
        for (int j = 0; j < m; j++)
        {
            if (i - 1 == a.at(j))
            {
                cost_back++;
            }
        }
    }

    cout << min(cost_forward, cost_back) << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;

int n, m;

int a[MAXN];

void read(){
	scanf("%d", &n);
	
	m= 0;
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
	}
	for(int i = 1; i <= n; i++)
		if (a[a[i]] == i)
			m++;
	printf("%d\n", m / 2);
}

void solve(){

}

void printans(){

}
	

int main(){
	int T = 1;
//	cin>>T;
	while(T--){
		read();
		solve();
		printans();
	}
	return 0;
} 


Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int in[3];
	int i,j;
	int tmp;

	while( scanf("%d %d %d", &in[0], &in[1], &in[2]) != EOF ){}

	for(i=0;i<3;i++){
		for(j=i+1;j<3;j++){
			if(in[i] > in[j]) {
				tmp = in[i];
				in[i] = in[j];
				in[j] = tmp;
			}
		}
	}

	printf("%d %d %d\n", in[0], in[1], in[2]);

	return 0;
}

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

namespace ConsoleApp15
{
    class Class28
    {
        static void Main()
        {
            string S = Console.ReadLine();
            int[] ans = new int[S.Length];
            for (int i = 0; i < S.Length; i++) ans[i] = 0;

            for(int i = 0; i < S.Length;)
            {
                int R = 0;
                int L = 0;
                for(; S[i] == 'R'&&i<S.Length; i++)
                {
                    R++;
                }
                int cp = i;

                for (; i < S.Length; i++)
                {
                    if (S[i] == 'L')
                        L++;
                    else break;
                }
                if (0 < cp && cp < S.Length)
                {
                    ans[cp - 1] = R / 2 + L / 2 + R % 2;
                    ans[cp] = R / 2 + L / 2 + L % 2;
                }
                else if (cp == 0)
                {
                    ans[0] = L;
                }
                else
                    ans[S.Length - 1] = R;
            }
            Console.WriteLine(string.Join(" ", ans));
        }
    }
}


Measured memory_bytes: 15200
n = int(input())
s = [input() for i in range(n)]

m = "abcdefghijklmnopqrstuvwxyz"
count = []

for x in m:
    cnt = 100
    for si in s:
        cnt = min(cnt,si.count(x))

    count.append(cnt)

res = ""
for i in range(26):
    res += m[i]*count[i]

print(res)

Measured memory_bytes: 3064
#include<iostream>

int main(){
    int i;
    int a,b,c;
    int count;

    std::cin>>a>>b>>c;

    count=0;
    for(i=a;i<=b;i++){
        if(c%i==0){
            count=count+1;
        }
    }
    std::cout<<count<<std::endl;

    return 0;
}


Measured memory_bytes: 3092
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int H, W;
    int h, w;
 
    while (1) {
        scanf("%d%d", &H, &W);
        if (H == 0 && W == 0) break;
         
        for (w = 0; w < W; w++) putchar('#');
        putchar('\n');
 
        for (h = 2; h < H; h++) {
            putchar('#');
            for (w = 2; w < W; w++) putchar('.');
            putchar('#');
            putchar('\n');
        }
 
        for (w = 0; w < W; w++) putchar('#');
        putchar('\n');
 
        putchar('\n');
    }
    return 0;
}




Measured memory_bytes: 2532
def main():
    for i in range(n):
        b, f, r, v = map(int, raw_input().split())
        x[b-1][f-1][r-1] += v
    for b in range(4):
        for f in range(3):
            print(' ' + ' '.join(map(str,x[b][f])))
        if b != 3:
            print('#'*20)
n = input()
x = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
main()

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n; cin >> n;
    vector<P> p(n);
    rep(i, n) {
        int a; cin >> a;
        p[i] = P(a, i+1);
    }
    sort(p.begin(), p.end());
    for(auto e : p) {
        cout << e.second << " ";
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    vector<char> S( 3 );
    REP( i, 3 )
    {
        cin >> S[ i ];
    }
    cout << count( ALL( S ), '1' ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define min3(a,b,c) min(min(a,b),c)

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(char *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        int num;
        scanf("%d", &num);
        arr[i] = num;
    }
    return 0;
}

#define NUM_MAX 1400

int main(void) {
    int height, width;
    get_int2(&height, &width);
    static char mat[NUM_MAX+1][NUM_MAX+1];
    static int dp[NUM_MAX+1][NUM_MAX+1];
    int i, j;
    for(i = 1; i <= height; i++) {
        fget_array(&mat[i][1], width);
        // 0: dirty, 1: clean(usable)
        for(j = 1; j <= width; j++) mat[i][j] = 1-mat[i][j];
    }
#ifdef DEBUG
    for(i = 1; i <= height; i++) {
        for(j = 1; j <= width; j++) printf(" %d", mat[i][j]);
        putchar('\n');
    }
#endif

    int ans = 0;
    for(i = 1; i <= height; i++) {
        for(j = 1; j <= width; j++) {
            if(!mat[i][j]) { dp[i][j] = 0; continue; }
            dp[i][j] = 1;
            if(mat[i-1][j-1] && mat[i][j-1] && mat[i-1][j]) {
                dp[i][j] = min3(dp[i-1][j-1], dp[i][j-1], dp[i-1][j]) + 1;
            }
            ans = max(dp[i][j], ans);
        }
    }

    printf("%d\n", ans*ans);
    return 0;
}


Measured memory_bytes: 11336
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    int c,g,dp[2001];
    vector<int> bks[11];
    for(int i=0;i<n;++i){
        cin>>c>>g;
        bks[g-1].push_back(c);
    }
    for(int i=0;i<10;++i){
        sort(bks[i].begin(),bks[i].end(),greater<int>());
    }
    memset(dp,-1,sizeof(dp));
    dp[0]=0;
    for(int i=0;i<10;++i){
        if(bks[i].empty()) continue;
        for(int j=k-1;j>=0;--j){
            if(dp[j]==-1) continue;
            int sum=0;
            for(int l=0;l<bks[i].size()&&j+l<k;++l){
                sum +=bks[i][l];
                dp[j+l+1]=max(dp[j+l+1],dp[j]+sum+(l+1)*l);
            }
        }
    }
    cout<<dp[k]<<endl;
    return 0;
}

Measured memory_bytes: 3156
#include <stdio.h>

int main (void)
{
  int n, r, minr, max = -1000000000;
  
  scanf("%d %d", &n, &minr);
  
  while (--n) {
    scanf("%d", &r);
    if (r - minr > max)
      max = r - minr;
    if (r < minr)
      minr = r;
  }
  
  printf("%d\n", max);
  
  return 0;
}



Measured memory_bytes: 2132
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<iostream>
#define K 100001
using namespace std;
int main()
{
  int n,ans;
  int a[K];
  int b[K]={0};
  ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++)
    {
      scanf("%d",&a[i]);
      if(a[i]>n)
	{
	  ans++;
	}
      else
	{
	  b[a[i]]++;
	}
    }
  for(int i=0;i<K;i++)
    {
      if(b[i]<i)
	{
	  ans+=b[i];
	}
      else if(b[i]>i)
	{
	  ans+=b[i]-i;
	}
    }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 1024
na = lambda: list(map(int, input().split()))
h, w = na()
ans = 111111111111
for a, b in [(w, h), (h, w)]:
    for i in range(1, b):
        for c, d in [(a, b-i), (b-i, a)]:
            l = [i*a, c*(d//2), c*(d-d//2)]
            ans = min(ans, max(l) - min(l))
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include <set>

#define DIV 1000000007
using namespace std;
using ll = long long;

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

    if (N >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int i,n;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=n;i>0;i--){
      if(Judge(i)==1 && Judge(i-2)==1){
        printf("%d %d\n",i-2,i);
	break;
      }
    }
  }
  return 0;
}

int Judge(int n)
{
  int i;
  if(n<2)return 0;
  if(n==2)return 1;
  if(n%2==0)return 0;
  for(i=3;i<n;i+=2){
    if(n%i==0)return 0;
  }
  return 1;
}

Measured memory_bytes: 596
H,W,D=map(int,input().split())
A=[[0,0]]*(H*W)
j=0
for i in range(H):
  for a in input().split():
    A[int(a)-1]=[i,j]
    j+=1
  j=0
Q=int(input())
S=[[0]*((H*W-1-i)//D+1) for i in range(D)]
for i in range(D):
  for k in range((H*W-1-i)//D):
    x1=A[D*k+i][0]
    x2=A[D*(k+1)+i][0]
    y1=A[D*k+i][1]
    y2=A[D*(k+1)+i][1]
    S[i][k+1]+=S[i][k]+abs(x1-x2)+abs(y1-y2)
ans=0
for q in range(Q):
  l,r=map(int,input().split())
  m=(l-1)%D
  ans=S[m][(r-1-m)//D]-S[m][(l-1-m)//D]
  print(ans)
  ans=0

Measured memory_bytes: 67420
s = input()
 
for bit in range(1 << 3):
  answer = int(s[0])
  f = s[0] 
  
  for i in range(3):
    if bit & (1 << i):
      f+='+'
      answer+=int(s[i+1])
    else:
      f+='-'
      answer-=int(s[i+1])
    f+=s[i+1]
 
  if answer==7:
    print(f + '=7')
    exit()

Measured memory_bytes: 3060