akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); i++)

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

  int r = 0;
  rep(i, 0, n) if (s[i] == 'R') r++;

  int cnt1 = 0, cnt2 = 0;
  rep(i, 0, n)
  {
    if (i < r and s[i] == 'W')
      cnt1++;
    if (i >= r and s[i] == 'R')
      cnt2++;
  }

  cout << max(cnt1, cnt2) << endl;

  return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  string s;
  cin >> s;

  if(s == "zyxwvutsrqponmlkjihgfedcba"){
    cout << -1 << endl;
  }
  else{
    map<ll, ll> m;
    REP(i, s.size())
      m[s[i]-'a'] += 1;

    if(s.size() < 26){
      cout << s;
      REP(i, 26){
        if(m[i] == 0){
          cout << (char)('a'+i) << endl;
          return 0;
        }
      }
    }
    else{
      ll n = s.size();
      set<ll> st;
      st.insert(s[n-1]-'a');
      for(ll i = n-2; i>=0; i--){
        auto it = upper_bound(st.begin(), st.end(), s[i]-'a');
        if(it != st.end()){
          REP(j, i)
            cout << s[j];
          cout << char('a'+*it) << endl;
          return 0;
        }
        else
          st.insert(s[i]-'a');
      }
    }
  }
}


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

int main() {
  int a, b;
  std::cin >> a >> b;
  if (a < b) {
    std::cout << "a" << " < " << "b" << std::endl;
  } else if (a > b) {
    std::cout << "a" << " > " << "b" << std::endl;
  }else {
    std::cout << "a" << " == " << "b" << std::endl;
  }
  return 0;
}



Measured memory_bytes: 3076
N = gets.to_i
S = Array.new(N + 1,0)
gets.split.map(&:to_i).each_with_index do |a,i|
  S[i + 1] = S[i] + a
end

def sum(l,r); S[r] - S[l]; end
def diff(l,mid,r); (sum(l,mid) - sum(mid,r)).abs; end
def max(a,b); a > b ? a : b; end
def diff4(sep1,sep2,sep3)
  [0,sep1,sep2,sep3,N].each_cons(2).map{|l,r| sum(l,r) }.minmax.inject(&:-).abs
end

# (0, sep1], (sep1, sep2], (sep2, sep3], (sep3, N]

SEP1 = Array.new(N + 1, 1)
SEP3 = Array.new(N + 1, -1)

ans = (2 .. N-2).map do |sep2|
  (SEP1[sep2 - 1] ... sep2).each do |sep1|
    if diff(0, sep1, sep2) <= diff(0, sep1 - 1, sep2)
      SEP1[sep2] = sep1
    else
      break
    end
  end
  
  (max(SEP3[sep2 - 1], sep2 + 1) ... N).each do |sep3|
    if SEP3[sep2] < 0 || diff(sep2, sep3, N) <= diff(sep2, sep3 - 1, N)
      SEP3[sep2] = sep3
    else
      break
    end
  end
  
  diff4(SEP1[sep2], sep2, SEP3[sep2])
end.min

puts ans

Measured memory_bytes: 28428
# a,b,c = 3.times.map(gets.to_i)
r=gets.strip.split("").map(&:to_i)


#.inject(:+)

#cnt=0
#while as.all?(|x|x.even?) do
  # cnt=cnt.succ
# end

# ans = (1..n)
#   .map{|i|[i,j]}
#   .select{|d|a <= d[1] && d[1]<= b}
#   .inject(0){|sum,d|sum+d[0]}
cnt = 0
(0..2).each do |i|
  cnt=1 if r[i]==r[i+1]
end

puts cnt==0 ? "Good" : "Bad"


Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#include <cmath>
#include <iomanip> //cout << fixed << setprecision(10) <<

#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;


class SegmentTree{
public:
    ll N;
    vector<ll> dat;
    ll INF = (1ll<<31);

public:
    SegmentTree(vector<ll> v){
        int sz = v.size();
        N = 1; 
        while(N < sz) N *= 2;
        dat.resize(2 * N - 1);
        for(int i = 0; i < sz; ++i) dat[i+N-1] = v[i];
        for(int i = N-2; i >= 0; --i) dat[i] = __gcd(dat[2*i+1], dat[2*i+2]);
    }

    void update(int i, ll x){
        i += N -1;
        dat[i] = x;
        while(i > 0){
            i = (i - 1) / 2;
            dat[i] = __gcd(dat[i*2+1],dat[i*2+2]);
        }
    }

    ll query(int a, int b, int k, int l, int r){
        if(a <= l && r <= b) return dat[k];
        else if(r <= a || b <= l) return INF;
        else{
            ll c1 = query(a, b, 2*k+1,l,(r+l)/2);
            ll c2 = query(a, b, 2*k+2,(r+l)/2, r);
            return __gcd(c1, c2);
        }
    }
};

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

    SegmentTree tree(a);


    ll ans = 0;
    for(int i = 1; i < n-1; i++){
        tree.update(i-1,a[i-1]);
        tree.update(i,a[i+1]);
        ans = max(ans,tree.dat[0]);
    }
    
    tree.update(n-2,a[n-2]);
    tree.update(0,a[1]);
    ans = max(ans, tree.dat[0]);
    tree.update(0,a[0]);
    tree.update(n-1,a[n-2]);
    ans = max(ans, tree.dat[0]);

    cout << ans << endl;
}


Measured memory_bytes: 6960
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
 
int main(){
    vector<int>x,y,d;
    static int zx[1000000+2],zy[1000000+2],zd[1000000+2],p[50][6],n,k,sea[102][102][102];
    long long int ans=0,a;
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++){
        for(int j=0;j<6;j++){
            scanf("%d",&p[i][j]);
        }
        x.push_back(p[i][0]);
        x.push_back(p[i][3]);
        y.push_back(p[i][1]);
        y.push_back(p[i][4]);
        d.push_back(p[i][2]);
        d.push_back(p[i][5]);
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    sort(d.begin(),d.end());
    int N=2*n+1;
    for(int i=0;i<N-1;i++){
        zx[x[i]]=i;
        zy[y[i]]=i;
        zd[d[i]]=i;
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int l=0;l<N;l++){
                sea[i][j][l]=0;
            }
        }
    }
     
    for(int i=0;i<n;i++){
        sea[zx[p[i][0]]][zy[p[i][1]]][zd[p[i][2]]]++;
        sea[zx[p[i][0]]][zy[p[i][1]]][zd[p[i][5]]]--;
        sea[zx[p[i][0]]][zy[p[i][4]]][zd[p[i][2]]]--;
        sea[zx[p[i][0]]][zy[p[i][4]]][zd[p[i][5]]]++;
        sea[zx[p[i][3]]][zy[p[i][1]]][zd[p[i][2]]]--;
        sea[zx[p[i][3]]][zy[p[i][1]]][zd[p[i][5]]]++;
        sea[zx[p[i][3]]][zy[p[i][4]]][zd[p[i][2]]]++;
        sea[zx[p[i][3]]][zy[p[i][4]]][zd[p[i][5]]]--;
    }
    for(int i=1;i<N;i++){
        for(int j=0;j<N;j++){
            for(int l=0;l<N;l++){
                sea[i][j][l]+=sea[i-1][j][l];
            }
        }
    }
    for(int i=0;i<N;i++){
        for(int j=1;j<N;j++){
            for(int l=0;l<N;l++){
                sea[i][j][l]+=sea[i][j-1][l];
            }
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int l=0;l<N;l++){
                if(l!=0)sea[i][j][l]+=sea[i][j][l-1];
                if(sea[i][j][l]>=k){
                    a=1;
                    a=x[i+1]-x[i];
                    a*=y[j+1]-y[j];
                    a*=d[l+1]-d[l];
                    ans+=a;
                }
            }
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 15212
a, b, c, d, e, f = list(map(int, input().split()))

water = {}
for i in range(f//(100*a)+1):
    for j in range(f//(100*b)+1):
        wtr = 100*a*i+100*b*j
        if wtr <= f and not wtr in water.keys():
            water[wtr] = 1
water = sorted(water.keys())[1:]

suger = {}
for i in range(f//c+1):
    for j in range(f//d+1):
        sgr = c*i+d*j
        if sgr <= f and not sgr in suger.keys():
            suger[sgr] = 1
suger = sorted(suger.keys())
# print(water, suger)

ans_w = 0
ans_s = 0
concent = 0
for wtr in water:
    for sgr in suger:
        if wtr+sgr > f:
            break
        if sgr > (wtr//100)*e:
            break
        if sgr/(sgr+wtr) >= concent:
            concent = sgr/(sgr+wtr)
            ans_w = wtr+sgr
            ans_s = sgr

print(ans_w, ans_s)


Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] h = new int[n];
        int[] c = new int[n];
        for(int i = 0; i < n; i++){
            h[i] = scanner.nextInt();
        }
        for(int i = 1; i < n; i++){
            int min = Integer.MAX_VALUE;
            for(int j = i - 1; j > -1 && j >= i - k; j--){
                min = Math.min(min, c[j]+Math.abs(h[j]-h[i]));
            }
            c[i] = min;
        }
        System.out.println(c[n-1]);
    }
}


Measured memory_bytes: 58388
package main

import (
	"fmt"
	"math"
)

func main() {

	var num int
	fmt.Scanln(&num)

	A := make([]float64, num)
	B := make([]float64, num)

	for i := range A {
		fmt.Scanf("%f", &A[i])
	}
	for i := range B {
		fmt.Scanf("%f", &B[i])
	}

	for i := 1.0; i < 4; i++ {

		dist := 0.0
		for n := range A {
			dist += math.Pow(math.Abs(A[n]-B[n]), i)
		}
		dist = math.Pow(dist, 1/i)
		fmt.Printf("%f\n", dist)
	}

	dist := 0.0
	for i := range A {
		if dist < math.Abs(A[i]-B[i]) {
			dist = math.Abs(A[i] - B[i])
		}
	}
	fmt.Printf("%f\n", dist)
}



Measured memory_bytes: 1180
#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    int t0 = 0;
    int x0 = 0;
    int y0 = 0;
    while(N--) {
        int t1, x1, y1;
        cin >> t1 >> x1 >> y1;
        int dt = t1 - t0;
        int dx = abs(x1 - x0);
        int dy = abs(y1 - y0);
        if((dx+dy)%2 != dt%2 || dx + dy > dt) {
            cout << "No" << endl;
            return 0;
        }
        t0 = t1;
        x0 = x1;
        y0 = y1;
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#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, m;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    while (n != 0) {
        int p[1005] = {};
        rep(i, n) cin >> p[i];
        vector<int> score;
        score.push_back(0);
        score.push_back(1e12);
        rep(i, n) score.push_back(p[i]);
        rep(i, n) rep(j, n) {
            score.push_back(p[i] + p[j]);
        }
        sort(all(score));
        score.erase(unique(all(score)), score.end());
        int ans = 0;
        rep(i, score.size()) {
            if (score[i] > m) break;
            int l = 0;
            int r = score.size() + 1;
            while (r - l > 1) {
                int mid = (r + l) / 2;
                if (score[i] + score[mid] <= m) l = mid;
                else r = mid;
            }
            int idx = l;
            if (score[i] + score[idx] > m) continue;
            ans = max(ans, score[i] + score[idx]);
        }
        cout << ans << endl;
        cin >> n >> m;
    }
}

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

int main(){
  int H,N,A[100000],sum=0;
  cin>>H>>N;
  for(int i=0;i<N;i++){
    cin>>A[i];
    sum+=A[i];
  }
  if(H<=sum){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  return 0;
}
  

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

int main()
{
  ll n;
  cin >> n;
  ll sum;
  sum = n + n*n + n*n*n;
  cout << sum <<endl;
  return 0;
}

Measured memory_bytes: 3576
def counting_sort(A, B, k):
    C = [0]*k 
    for a in A:
        C[a] += 1
    for i in range(1, k):
        C[i] += C[i - 1] 
    for a in A:
        B[C[a] - 1] = a
        C[a] -= 1

n = int(input())
arr = list(map(int, input().split()))
B = [0]*n
counting_sort(arr, B, 10001)
print(*B)


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

int main() {
	int a,b,k; 
    int tmp;
        
        cin >> k >> a >> b; 
        
        tmp = k;
		
		for(;;){
			
            if(k >= a && k <=b){
            	cout << "OK";
                break;
           
            }
          if (k > b){
            	cout << "NG";
				break;
          }
            k += tmp;
        }
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#define MOD_BY UINT32_C(1000000007)

uint32_t add(uint32_t a, uint32_t b) {
	uint32_t r = a + b;
	if (r >= MOD_BY) r -= MOD_BY;
	return r;
}

uint32_t sub(uint32_t a, uint32_t b) {
	return b == 0 ? a : add(a, MOD_BY - b);
}

uint32_t mul(uint32_t a, uint32_t b) {
	return (uint32_t)((uint64_t)a * b % MOD_BY);
}

uint32_t pou(uint32_t a, uint32_t b) {
	uint32_t r = 1;
	while (b > 0) {
		if (b & 1) r = mul(r, a);
		a = mul(a, a);
		b >>= 1;
	}
	return r;
}

uint32_t inv(uint32_t a) {
	return pou(a, MOD_BY - 2);
}

int K;
int len;
int total;
char S[1234567];

uint32_t bikkuri[2345678];
uint32_t bikkuri_inv[2345678];
uint32_t enuzyou[2345678];
uint32_t enuzyou[2345678];

uint32_t nCk(uint32_t n, uint32_t k) {
	if (n < k) return 0;
	return mul(mul(bikkuri[n], bikkuri_inv[n - k]), bikkuri_inv[k]);
}

int main(void) {
	int i;
	uint32_t ans;
	if (scanf("%d", &K) != 1) return 1;
	if (scanf("%1234566s", S) != 1) return 1;
	len = (int)strlen(S);
	total = K + len;

	bikkuri[0] = 1;
	bikkuri_inv[0] = 1;
	enuzyou[0] = 1;
	for (i = 1; i <= total; i++) {
		bikkuri[i] = mul(bikkuri[i - 1], i);
		bikkuri_inv[i] = inv(bikkuri[i]);
		enuzyou[i] = mul(enuzyou[i - 1], 25);
	}

	ans = pou(26, total);
	for (i = 0; i < len; i++) {
		ans = sub(ans, mul(nCk(total, i), enuzyou[total - i]));
	}

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

/*

int search(int allpos, int spos) {
	int ans = 0;
	int i;
	if (allpos >= K + |S|) return spos == |S|;
	// メモ読み
	for (i = 0; i < 26; i++) {
		ans += search(allpos + 1, spos + (spos != |S| && S[spos] == 'a' + i));
	}
	// メモ書き
	return ans;
}

*/

/*

spos < |S| のとき、一致するパターンが必ず1個、他が必ず25個

Sの文字を全部aにしてもおｋ (多分)

全部のパターン数 - aを使う回数が|S|未満のパターン数

aを使う回数がkのパターン数 = (K+|S|)Ck * 26**(K+|S|-k)

nCrは掛け算3回 → テーブル
*/


Measured memory_bytes: 26148
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
using namespace std;


int main ()
{

string s;
cin >> s;

int l=s.length();

for(int i=0;i<l;i++)
{
	if(s[i]=='9')
	{
		cout << "1";
	}
	else
	{
		cout << "9";
	}
}


 	return 0;
}












Measured memory_bytes: 3648
# -*- coding: utf-8 -*-

### TESTCASE
test = ""
#test = \
"""
2
3
"""

"""
4
7
"""

"""
10
15
"""

"""
1000000000000
1099511627775
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN

h = int(input2())

c = 0
while h:
    h //= 2
    c += 1

s = 0
v = 1
while c:
    c -= 1
    s += v
    v *= 2


print(s)






Measured memory_bytes: 3060
x,y,a,b,c = map(int,input().split())
lst_r = list(map(int,input().split()))
lst_g = list(map(int,input().split()))
lst_n = list(map(lambda x:int(x)*(-1),input().split()))
from heapq import *

heapify(lst_r)
for i in range(a-x):
    _ = heappop(lst_r)

heapify(lst_g)
for i in range(b-y):
    _ = heappop(lst_g)
    
heapify(lst_n)

while len(lst_n)>0:
    flg = lst_r > lst_g
    cur = -1 * heappop(lst_n)
    if flg and cur > lst_g[0]:
        _ = heappushpop(lst_g,cur)
    elif (not flg) and cur > lst_r[0]:
        _ = heappushpop(lst_r,cur)
    else:
        break
print(sum(lst_g)+sum(lst_r))

Measured memory_bytes: 23328
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for i in range(n)]
xh.sort()
r,tama=[float('inf')]*n,[0]*(n+1)

for i in range(n):
    x,h=xh[i]
    tmpr=bisect.bisect_left(r,x)
    h-=(tama[i]-tama[tmpr])*a
    tmp=0
    if h>0:
        tmp=math.ceil(h/a)
    tama[i+1]=tmp
    tama[i+1]+=tama[i]
    r[i]=x+2*d

print(tama[-1])
# print(r)

Measured memory_bytes: 124760
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 310;
typedef pair<int,int> pi;
#define f first 
#define s second

int h,w,d;
int A[maxn][maxn];
int cost[maxn][maxn];
map <int, pi> mp;

void dfs(int i, int j) {
	int cur = A[i][j];
	if (mp.find(cur + d) == mp.end()) return;
	pi nn = mp[cur + d];
	cost[nn.f][nn.s] = cost[i][j] + abs(nn.f - i) + abs(nn.s - j);
	dfs(nn.f, nn.s);
}

int main() {
	cin >> h >> w >> d;
	for (int i =1;i<=h;i++) {
		for (int j=1;j<=w;j++) {
			cin >> A[i][j];
			mp[A[i][j]] = pi(i,j);
		}
	}
	memset(cost,-1,sizeof cost);
	for (int i =1;i<=h;i++) {
		for (int j=1;j<=w;j++) {
			if (cost[i][j] == -1) {
				cost[i][j] = 0;
				dfs(i,j);
			}
		}
	}
	
	int q;
	cin >>q;
	for (int i =0;i<q;i++) {
		int l,r; cin >> l >> r;
		pi n1 = mp[l];
		pi n2 = mp[r];
		cout << cost[n2.f][n2.s] - cost[n1.f][n1.s] << "\n";
		
	}
}




Measured memory_bytes: 8832
#include<bits/stdc++.h>
using namespace std;
#define ll  int
#define fr first
#define sc second
#define MAX ((ll)(1e18+100))
#define MOD ((ll)(1e9+7))
#define HS1 ((ll)(137))
#define HS2 ((ll)(1e9+9))
#define ARRS ((ll)(6e5+900))
#define pb push_back
#define mid ((l+r)>>1)
#define PI 3.14159265358979323846

int main(){
	string s;
	ll k=0;
	cin>>s;
	for(int i=0; i<s.size()-1; i++){
		if(s[i]=='A'&&s[i+1]=='C')k=3;

	}
	if(k==3)cout<<"Yes";
	else cout<<"No";
	return 0;
}


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

void IF()
{
    int a, b;
    cin >> a >> b;

    if(a<b)
        cout << "a < b" << endl;
    if(a==b)
        cout << "a == b" << endl;
    if(a>b)
        cout << "a > b" << endl;
}

int main()
{
    IF();
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll q, n, a, b, c, d;
unordered_map<ll, ll> values;

ll min_price(ll n) {
    if (n == 1)
        return d;

    if (values.find(n) != values.end())
        return values[n];

    bool found1 = false, found2 = false, found3 = false;
    values.insert(make_pair(n, 2e18));

    if (n % 2 == 0) {
        values[n] = min(values[n], a + min_price(n / 2));
        if ((n / 2) <= (4e18 - min_price(n / 2)) / d)
            values[n] = min(values[n], d * (n / 2) + min_price(n / 2));
        found1 = true;
    }
    if (n % 3 == 0) {
        values[n] = min(values[n], b + min_price(n / 3));
        if (2 * (n / 3) <= (4e18 - min_price(n / 3)) / d)
            values[n] = min(values[n], d * 2 * (n / 3) + min_price(n / 3));
        found2 = true;
    }
    if (n % 5 == 0) {
        values[n] = min(values[n], c + min_price(n / 5));
        if (4 * (n / 5) <= (4e18 - min_price(n / 5)) / d)
            values[n] = min(values[n], d * 4 * (n / 5) + min_price(n / 5));
        found3 = true;
    }

    if (!found1 || !found2 || !found3) {
        values[n] = min(values[n], d + min_price(n - 1));
        values[n] = min(values[n], d + min_price(n + 1));
    }

    return values[n];
}

int main(){
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> q;
    while (q--) {
        cin >> n >> a >> b >> c >> d;
        values.clear();
        cout << min_price(n) << '\n';
    }
    return 0;
}


Measured memory_bytes: 10552
#include<stdio.h>
#include<stdlib.h>

typedef long long int int64;

#define POS(i,j) ((i)*w+(j))

void run(void){
  int h,w;
  scanf("%d%d",&h,&w);
  char *s=(char *)calloc(h*w+1,sizeof(char));
  int i;
  for(i=0;i<h;i++) scanf("%s",s+i*w);
  char *used=(char *)calloc(h*w,sizeof(char));
  int *now=(int *)calloc(1000,sizeof(int));
  int *next=(int *)calloc(1000,sizeof(int));
  int64 ans=0;
  for(i=0;i<h*w;i++){
    if(used[i]) continue;
    used[i]=1;
    int cnt[2]={0,0};
    int k=0;
    int top=0;
    now[top++]=i;
    while(top>0){
      cnt[k]+=top;
      int nextTop=0;
      while(top>0){
	const int p=now[--top];
	const int x=p/w;
	const int y=p%w;
	const int d[4]={-1,0,1,0};
	for(int j=0;j<4;j++){
	  int a=x+d[j];
	  int b=y+d[j^1];
	  if(0<=a && a<h && 0<=b && b<w && s[POS(x,y)]!=s[POS(a,b)] && !used[POS(a,b)]){
	    used[POS(a,b)]=1;
	    next[nextTop++]=a*w+b;
	  }
	}
      }
      int *swap=now;
      now=next;
      next=swap;
      top=nextTop;
      k^=1;
    }
    ans+=(int64)cnt[0]*cnt[1];
  }
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 512
MOD = int(10 ** 9 + 7)
L = input()
dp1 = [0] * len(L)
# always under L
dp2 = [0] * len(L)
# 00
dp1[0] = 1
# 10 01
dp2[0] = 2
for i, s in enumerate(L):
    if i == 0:
        continue
    # 01 10 00
    if s == "1":
        # 01 10
        dp2[i] = dp2[i - 1] * 2
        # 00
        dp1[i] = dp1[i - 1] * 3 + dp2[i - 1] * 1
    else:
        # 00
        dp2[i] = dp2[i - 1] * 1
        dp1[i] = dp1[i - 1] * 3
    dp1[i] %= MOD
    dp2[i] %= MOD
n = len(L)
print((dp1[n - 1] + dp2[n - 1]) % MOD)


Measured memory_bytes: 11072
#include <stdio.h>
#include <set>
#include <utility>
using namespace std;

int main(void) {
  long long i, n, m, now = 0, a, ans = 0;
  scanf("%lld%lld", &n, &m);
  set< pair<long long, long long> > s;
  s.insert(make_pair(0, 1));
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a);
    now += a, now %= m;
    pair<long long, long long> p = make_pair(now, 1);
    if(s.lower_bound(p) != s.end() && (*s.lower_bound(p)).first == now) {
      long long tmp = (*s.lower_bound(p)).second;
      s.erase(s.lower_bound(p));
      p.second = tmp + 1;
      ans += tmp;
      s.insert(p);
    } else s.insert(p);
  }
  printf("%lld", ans);
  return 0; 
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
bool ispali(string s)
{
    ll i,j,k,l=s.length();
    i=0;
    j=l-1;
    while(i<l/2)
    {
        if(s[i]!=s[j])
        return false;
        i++;
        j--;
    }
    return true;
}
int main()
{
    ll t,i,j,k,l,m,n,o,p,q,r,s,a[100002];
   string ss;
   cin>>ss;
   n=ss.length();
   bool f1=ispali(ss);
   p=(n-1)/2;
   q=(n+3)/2;
   q--;
   string s1=ss.substr(0,p);
   string s2=ss.substr(q,n-q);
   //cout<<s1<<" "<<s2<<endl;
   if(f1&&ispali(s1)&&ispali(s2))
   {
       cout<<"Yes\n";
       return 0;
   }
   cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  vector<char>c(n);
  int red=0;
  for(int i=0;i<n;i++){
    cin>>c.at(i);
    if(c.at(i)=='R')red++;
  }
  int ans=0;
  for(int i=0;i<n;i++){
    if(c.at(i)=='W'&&red!=0){ans++;red--;}
    else if(c.at(i)=='R'&&red!=0)red--;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>
#include <locale>
#include <omp.h>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;
typedef pair<long long int, pll> lpll;

const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 
//const long long int pl=1000000;
long long int N,X,m[200200],res=0,x,a,b;


int main(){
    cout << fixed << setprecision(18);
    cin>>x>>a>>b;
    if(abs(x-a)>abs(x-b)){
        cout<<'B'<<endl;
    }else{
        cout<<'A'<<endl;
    }
}



Measured memory_bytes: 3624
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=128;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

vector<string> now;
int n,m;

int ask(string s)
{
    cout << "? " << s << endl;fflush(stdout);
    int x=read();return x;
}

string solve(int l,int r)
{
    if (l==r) return now[l];
    int mid=(l+r)>>1;
    string s1=solve(l,mid),s2=solve(mid+1,r),s="";
    int n1=s1.size(),n2=s2.size(),p1=0,p2=0,need=n-n1;
    //cout << "now " << s1 << " " << s2 << endl;
    rep(i,0,n1-1)
    {
        while (p2<n2)
        {
            string t=s+s2[p2]+s1.substr(i,n1);
            if (ask(t)==need-1)
            {
                need--;s=s+s2[p2++];
            }
            else break;
        }
        s=s+s1[i];
    }
    while (p2<n2) s=s+s2[p2++];
    //cout << "merge " << l << " " << r << " " << s << endl;
    return s;
}

void answer(string s)
{
    cout << "! " << s << endl;fflush(stdout);
}

int main()
{
    string str="";
    rep(i,0,25) str=str+(char)('a'+i);
    rep(i,0,25) str=str+(char)('A'+i);
    rep(i,0,9) str=str+(char)('0'+i);
    //cout << str << endl;
    int siz=str.size();
    rep(i,0,siz-1)
    {
        string s="";
        rep(j,1,N) s=s+str[i];
        int cnt=ask(s);
        if (cnt<N) {n+=(N-cnt);now.pb(s.substr(0,N-cnt));}
    }
    int m=now.size();
    //cout << "m=" << m << endl;
    //rep(i,0,m-1) cout << now[i] << " ";cout << endl;
    string ans=solve(0,m-1);
    answer(ans);
    return 0;
}

Measured memory_bytes: 3796
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	x,y = map(int,input().split())	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# 3
# hoge
# foo
# bar
# n=int(input())
# string_list=[input() for i in range(n)]
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))

now=999999999999
for i, H_i in enumerate(H):
    temp = T - H_i*0.006
    if(abs(temp-A)<abs(now-A)):
        ans = i
        now = temp

print(ans+1)


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

using namespace std;

const int MAX = 200005;
int N;
char X[MAX];

void slove() {
    int ans = 0;

    stack<bool> S;

    for (int i = 0; i < N; ++i) {
        if (X[i] == 'S') {
            S.push(1);
        } else if (X[i] == 'T') {
            if (S.size() > 0) {
                S.pop();
            } else {
                ans++;
            }
        }
    }

    ans += S.size();

    cout << ans << endl;
}

int main(int argc, char* argv[]) {
    cin >> X;

    N = strlen(X);

    slove();

    return 0;
}


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

using namespace std;

int a[110] = { 0 };
vector<int> v;

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = n; i > 0; i--) {
		if (i  == a[i]) {
			v.push_back(i);
			for (int j = i; j <= n; j++) {
				a[j] = a[j + 1];
			}
			i = n - 1;
		}
	}
	if (v.size() == n) {
		for (int i = v.size() - 1; i >= 0; i--) {
			cout << v[i] << endl;
		}
	}
	else {
		cout << -1;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  int n;
  cin >> n;
  vi a(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a));
  int ans=a[n-1]-a[0];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
#!/usr/bin/env ruby
n, k = gets.chomp.split.map(&:to_i)

a = gets.chomp.split.map(&:to_i)

town_a = [nil, a].flatten
visited_count = Array.new(n + 1, 0)
@marked_town = nil
@loop_length = 0

now = town_a[1]
counter = 1

loop do
  return puts now if counter == k

  if @marked_town.nil?
    visited_count[now] += 1
    @marked_town = now if visited_count[now] == 2
  else
    @loop_length += 1

    if now == @marked_town
      nokori = (k - counter) % @loop_length

      nokori.times do
        now = town_a[now]
      end
      return puts now
    end
  end

  now = town_a[now]
  counter += 1
end




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


int main(){
	int n,a,sum=0;
	vector<int> v;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n-1;i++){
		sum+=v[i];
	}
	
	if(sum>v[n-1]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
lli A, B, C, a, b, c;

int main(void){
  cin >> A >> B >> C;
  a = A;
  b = B;
  c = C;
  int res = 0;
  while(a%2 == 0 && b%2 == 0 && c%2 == 0){
    lli na, nb, nc;
    na = b/2 + c/2;
    nb = c/2 + a/2;
    nc = a/2 + b/2;
    a = na;
    b = nb;
    c = nc;
    res++;
    if(res >= 50){
      res = -1;
      break;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <typeinfo>

int main(){
    int n;
    int tmp=0;
    std::cin >> n;
    int a[2*n];
    for (int i=0; i<2*n; i++) std::cin >> a[i];
    std::sort(a, a+2*n);
    for (int i=1; i<2*n; i+=2){
        tmp += std::min({a[i-1], a[i]});
    }
    std::cout << tmp << std::endl;
    
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == 'C') {
            cnt++;
        }
        if(cnt >= 1 && s[i] == 'F') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


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

int main() {
  int N, M, ans = 0;
  cin >> N >> M;
  if (N > 1) {
    ans += N * (N - 1) / 2;
  }
  if (M > 1) {
    ans += M * (M - 1) / 2;
  }
  cout << ans;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn main() {
  let s: String = read();
  let mut cs: Vec<char> = s.chars().collect();
  cs.sort();
  
  let ans = if cs[0] == cs[1] && cs[1] != cs[2] && cs[2] == cs[3] { "Yes" } else { "No" };

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


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>
#include <functional>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

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

int main(){
    vector<int> vec(3);
    rep(i,3) cin >> vec[i];
    sort(vec.begin(), vec.end());
    cout << abs(vec[2]-vec[1]) + abs(vec[1]-vec[0]) << endl;
    
    return 0;
}

Measured memory_bytes: 256
import math
N=int(input())
c=N+1
n=math.sqrt(N)
n=n//1
n=int(n)
for i in range(1,n+1):
    if N%i==0:
        a=i
        b=N//i
        if c>a+b:
            c=a+b
print(c-2)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <stack>
#include <queue>
using namespace std;

int main() {
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 2 == 0) continue;
        int cnt = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) cnt++;
        }
        if (cnt == 8) { ans++; }
    }
    cout << ans << "\n";

    return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(s) (s).begin(), (s).end()
const ll MOD = 1e9 + 7;
vll height, maxm;
int ans = 0;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int n, m;
    cin >> n >> m;
    height.resize(n), maxm.resize(n, 0);
    for (int i = 0; i < n; i++)
        cin >> height[i];
    for (int i = 0; i < m; i++)
    {
        ll a, b;
        cin >> a >> b;
        a--,b--;
        maxm[a] = max(maxm[a], height[b]);
        maxm[b] = max(maxm[b], height[a]);
    }
    for (int i = 0; i < n; i++)
        if (height[i] > maxm[i])
            ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4752
def solve(string):
    h, w, d, *a = map(int, string.split())
    a, q, lr = a[:h * w], a[h * w], a[h * w + 1:]
    n = h * w
    index = [0 for _ in range(n)]
    for i, _a in enumerate(a):
        index[_a - 1] = i
    diff = [0] * d + [
        abs(i0 // w - i1 // w) + abs(i0 % w - i1 % w) for i0, i1 in zip(index, index[d:])
    ]
    for i in range(n):
        if i >= d:
            diff[i] += diff[i - d]
    return "\n".join([str(diff[r - 1] - diff[l - 1]) for l, r in zip(lr[::2], lr[1::2])])


if __name__ == '__main__':
    n, m, d = map(int, input().split())
    ins = '{} {} {}\n'.format(n, m, d) + '\n'.join([input() for _ in range(n)])
    n = int(input())
    print(solve(ins + '\n{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 36776
import math
from collections import deque
from collections import defaultdict
import itertools as it

#自作関数群
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()
def factorization(n):
  res = []
  if n%2==0:
    res.append(2)
  for i in range(3,math.floor(n//2)+1,2):
    if n%i==0:
      c = 0
      for j in res:
        if i%j==0:
          c=1
      if c==0:
        res.append(i)
  if len(res)==0:
    res = [n]
  return res
def fact2(n):
  p = factorization(n)
  res = []
  for i in p:
    c=0
    z=n
    while 1:
      if z%i==0:
        c+=1
        z/=i
      else:
        break
    res.append([i,c])
  return res
def fact(n):#階乗
  ans = 1
  m=n
  for _i in range(n-1):
    ans*=m
    m-=1
  return ans
def comb(n,r):#コンビネーション
  if n<r:
    return 0
  l = min(r,n-r)
  m=n
  u=1
  for _i in range(l):
    u*=m
    m-=1
  return u//fact(l)
def combmod(n,r,mod):
  return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
  r=copyQueue(q)
  ans=[0]*r.qsize()
  for i in range(r.qsize()-1,-1,-1):
    ans[i] = r.get()
  print(ans)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1]*n

  def find(self, x): # root
    if self.parents[x]<0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self,x,y):
    x = self.find(x)
    y = self.find(y)

    if x==y:
      return

    if self.parents[x]>self.parents[y]:
      x,y = y,x

    self.parents[x]+=self.parents[y]
    self.parents[y]=x

  def size(self,x):
    return -1*self.parents[self.find(x)]

  def same(self,x,y):
    return self.find(x)==self.find(y)

  def members(self,x): # much time
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i)==root]

  def roots(self):
    return [i for i,x in enumerate(self.parents) if x<0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
  x = 1
  zero = "0"*n
  ans = []
  ans.append([0]*n)
  for i in range(2**n-1):
    ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
    x+=1
  return ans;
def arrsSum(a1,a2):
  for i in range(len(a1)):
    a1[i]+=a2[i]
  return a1
def maxValue(a,b,v):
  v2 = v
  for i in range(v2,-1,-1):
    for j in range(v2//a+1): #j:aの個数
      k = i-a*j
      if k%b==0:
        return i
  return -1
def copyQueue(q):
  nq = queue.Queue()
  n = q.qsize()
  for i in range(n):
    x = q.get()
    q.put(x)
    nq.put(x)
  return nq
def get_sieve_of_eratosthenes(n):
  data = [2]
  #data = [0,0,0]
  for i in range(3,n+1,2):
    data.append(i)
    data.append(0)
  for i in range(len(data)):
    interval = data[i]
    if interval!=0:
      for j in range(i+interval,n-1,interval):
        data[j] = 0
  ans = [x for x in data if x!=0]
  #ans = data[:]
  return ans


a,b = readInts()

#print(a+b)
print(a*b)

Measured memory_bytes: 9572
#include <iostream>

int n;

int main() {
  std::cin >> n;
  std::string s = std::to_string(n);
  for (int i = 0; i< s.size(); i++) {
    if (s[i] == '7') {
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
  return 0;
}

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

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int diffX = tx - sx;
    int diffY = ty - sy;

    for(int i = 0; i < diffX; ++i)
    {
        cout << 'R';
    }
    for(int i = 0; i < diffY; ++i)
    {
        cout << 'U';
    }

    for(int i = 0; i < diffX; ++i)
    {
        cout << 'L';
    }
    for(int i = 0; i < diffY; ++i)
    {
        cout << 'D';
    }

    cout << 'D';
    for(int i = 0; i < diffX; ++i)
    {
        cout << 'R';
    }
    cout << 'R';
    for(int i = 0; i < diffY; ++i)
    {
        cout << 'U';
    }
    cout << "UL";

    cout << 'U';
    for(int i = 0; i < diffX; ++i)
    {
        cout << 'L';
    }
    cout << 'L';
    for(int i = 0; i < diffY; ++i)
    {
        cout << 'D';
    }
    cout << "DR" << endl;

    
}

Measured memory_bytes: 384
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
M=max(A)+1
table=[0 for _ in range(M)]

for i in range(N):
    if i>0 and A[i]==A[i-1]:
        table[A[i]]=0
        continue
    table[A[i]]=1
    for n in range(2,M):
        if A[i]*n>=M:
            break
        table[A[i]*n]=0
print(sum(table))

Measured memory_bytes: 32228
import java.util.*;

class Main {
   public static void main(String[] args)
   {
      Scanner scan = new Scanner(System.in);
      int     n    = scan.nextInt();
      long    abs  = 0;

      long[] A   = new long[n + 2];
      long   sum = 0;
      A[0] = A[n + 1] = 0;
      for(int i = 1; i < n + 1; i++){
          A[i] = scan.nextLong();
          }
      for(int i = 0; i < n + 1; i++){
          sum += Math.abs(A[i] - A[i + 1]);
          }
      for(int i = 1; i < n + 1; i++){
          abs = 0;
          if(A[i] > A[i - 1] && A[i] > A[i + 1]){
             abs  = Math.abs(A[i] - A[i - 1]) + Math.abs(A[i] - A[i + 1]);
             abs -= Math.abs(A[i - 1] - A[i + 1]);
             System.out.println(sum - abs);
             }
          else if(A[i] < A[i - 1] && A[i] < A[i + 1]){
                  abs  = Math.abs(A[i] - A[i - 1]) + Math.abs(A[i] - A[i + 1]);
                  abs -= Math.abs(A[i - 1] - A[i + 1]);
                  System.out.println(sum - abs);
                  }
          else{
              System.out.println(sum);
              }
          }


      //System.out.println(count);
   }
}


Measured memory_bytes: 78776
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
typedef long long ll;
using namespace std; 
using P = pair<int,int>;
const ll mod = 1e9+7;
const int INF = 1001001001;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
  

int main(){
  int a,b;
  cin >> a >> b;
  cout << a*b << endl;
  return 0;
  
}


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

using namespace std;
int main(){
  long n,m;
   cin >> n >> m;
  
  if(n==1&&m==1) cout << 1 << endl;
  else if(n==1||m==1) cout << max(n-2,m-2) << endl;
  else cout << (n-2)*(m-2) << endl;
  
}

Measured memory_bytes: 256
//Snake Toy
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for(int i=0; i<n; i++){
        cin >> l[i];
    }
    int sum=0;
    sort(l.begin(), l.end());
    for(int i=1; i<=k; i++){
        sum+=l[n-i];
    }
    cout << sum << endl;
    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

typedef long long ll;
ll N,M;
int main(){
	cin >> N >> M;
	if(M==1&&N==1) cout << 1 << endl;
	else if(M==1||N==1) cout << max(M,N)-2 << endl;
	else cout << (N-2)*(M-2) << endl;	
}

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

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

int main() {
    int N;
    ll a, b;
    a = 0; b = 10000000000;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ll A;
        cin >> A;
        a = max(a, A);
        b = min(b, A);
    }
    cout << a - b << endl;
    return 0;
}

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

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

    let answer = solve(&buf);

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

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

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

    let ans: usize = p.iter().sum::<usize>() - p.iter().max().unwrap() / 2;
    ans.to_string()
}


Measured memory_bytes: 2128
#include <iostream>
#include <string>
#include <algorithm>
#include<math.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;


int main(){
    int N,K,Q,A[100000];
    cin >> N >> K >> Q;
    rep(i,Q) cin >> A[i];
    int P[100000] = {K};
    int B[100000] = {0};
    rep(i,N) P[i] = K;
    rep(i,Q) B[A[i]-1] += 1;
    rep(i,N){
        P[i] = P[i] - (Q - B[i]);
        if(P[i]<=0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 1792