akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int main() {
    // your code goes here
    ll R,C,K,r,c,v;
    cin >> R >> C >> K;
    vector<vcl> vs(3005,vcl(3005));
    vector<vcl> dp0(3005,vcl(3005));
    vector<vcl> dp1(3005,vcl(3005));
    vector<vcl> dp2(3005,vcl(3005));
    vector<vcl> dp3(3005,vcl(3005));
    ll ans=0;
    rep(i,1,K){
    	cin >> r >> c >> v;
    	vs[r][c]=v;
    }
    rep(i,1,R){
    	rep(j,1,C){
    		rep(k,0,3){
    			if(k==0){
    				chmax(dp0[i][j],dp0[i][j-1]);
    				chmax(dp0[i][j],dp0[i-1][j]);
    				chmax(dp0[i][j],dp1[i-1][j]);
    				chmax(dp0[i][j],dp2[i-1][j]);
    				chmax(dp0[i][j],dp3[i-1][j]);
    			} else if(vs[i][j]==0) {
    				chmax(dp0[i][j],dp0[i][j-1]);
    				chmax(dp1[i][j],dp1[i][j-1]);
    				chmax(dp2[i][j],dp2[i][j-1]);
    				chmax(dp3[i][j],dp3[i][j-1]);
    			} else if(k!=1) {
    				chmax(dp2[i][j],dp2[i][j-1]);
    				chmax(dp3[i][j],dp3[i][j-1]);
    				chmax(dp2[i][j],dp1[i][j-1]+vs[i][j]);
    				chmax(dp3[i][j],dp2[i][j-1]+vs[i][j]);
    			} else {
    				chmax(dp1[i][j],dp1[i][j-1]);
    				chmax(dp1[i][j],dp0[i][j-1]+vs[i][j]);
    				chmax(dp1[i][j],dp0[i-1][j]+vs[i][j]);
    				chmax(dp1[i][j],dp1[i-1][j]+vs[i][j]);
    				chmax(dp1[i][j],dp2[i-1][j]+vs[i][j]);
    				chmax(dp1[i][j],dp3[i-1][j]+vs[i][j]);
    			}
    		}
    	}
    }
    chmax(ans,dp0[R][C]);
    chmax(ans,dp1[R][C]);
    chmax(ans,dp2[R][C]);
    chmax(ans,dp3[R][C]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 356500
from heapq import*
n,m=map(int,input().split())
x=[[]for _ in range(m)]
for _ in range(n):
  a,b=map(int,input().split())
  if a<=m:x[a-1]+=[-b]
q=[]
ans=0
for i in range(m):
  for j in x[i]:heappush(q,j)
  if q:ans-=heappop(q)
print(ans)

Measured memory_bytes: 88004
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
sum_ = sum(a)
ans = 0
if sum_ % 10 != 0:
    print(sum_)
else:
    for j in a:
        if (sum_ - j)%10 != 0:
            ans = sum_-j
            break
    print(ans)

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


void solve(long long N, std::vector<long long> V, std::vector<long long> C){
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if(V[i] > C[i]){
            ans += V[i]- C[i];
        }
    }
    cout << ans << endl;
    
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> V(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&V[i]);
    }
    std::vector<long long> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(V), std::move(C));
    return 0;
}


Measured memory_bytes: 256
from operator import itemgetter

n = int(input())

wrap = []

for i in range(n):
    input_data = input()
    wrap.append([i+1, input_data.split()[0], int(input_data.split()[1])])

wrap.sort(key=itemgetter(2), reverse=True)
wrap.sort(key=itemgetter(1))

for i in wrap:
    print(i[0])

Measured memory_bytes: 3060
#!/usr/bin/env ruby
N,M = gets.split.map(&:to_i)
H = gets.split.map(&:to_i)
h = H.dup
MAP = M.times.map { gets.split.map(&:to_i) }

(0...M).each do |i|
  a = MAP[i][0] - 1
  b = MAP[i][1] - 1
  if H[a] == H[b]
    h[a] = h[b] = 0
  elsif H[a] < H[b]
    h[a] = 0
  else
    h[b] = 0
  end
end
res = 0
(0...N).each do |i|
  res += 1 if h[i] != 0
end
puts res

Measured memory_bytes: 23188
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n);
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

int
main(void){ 
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  int s1_itr = 1, s2_itr = 0, s3_itr=0;
  char turn = s1[0];
  string ans = "";
  for(;;){
    //if(s1_itr+1 == s1.size() || s2_itr+1 == s2.size() || s3_itr+1 == s3.size()) break;    
    //cout << "turn:" << turn << s1_itr << s2_itr << s3_itr<< endl;
    if(turn == 'a'){
      if(s1_itr == s1.size()) {ans = "A"; break;}
      turn = s1[s1_itr];
      s1_itr++;
    }
    else if(turn == 'b'){
      if(s2_itr == s2.size()) {ans = "B"; break;} 
      turn = s2[s2_itr];
      s2_itr++;
    }
    else{
      if(s3_itr == s3.size()) {ans = "C"; break;}           
      turn = s3[s3_itr];
      s3_itr++;
    }
    
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
long long binpow(long long a,long long b)
{
    if (b == 1) return a;
    long long res = binpow(a, b/2)%MOD;
    if (b % 2) return (res*((res*a)%MOD))%MOD;
    else return (res * res)%MOD;
}

long long int fact(long long int a)
{
    if(a==0||a==1)
        return 1;
    long long int ans = 1;
    for(int i=a;i>=1;i--)
        ans = (ans * i)% MOD;
    return ans;
}

long long int ivmod(long long int a)
{
    return binpow(a,MOD-2);
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    // #endif
    int w ,a,b;
    cin>>w>>a>>b;
    int ans = min(abs(a+w-b),abs(b+w-a));
    if(b>=a&&b<=(a+w))
        cout<<0;
    else if((b+w)>=a&&(b+w)<=(a+w))
        cout<<0;
    else
        cout<<ans;
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
#-------------------------------------------------------------------
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
H,W = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

S=[ "" for _ in range(H+2) ]
#p(S)

S[0]="#"*(W+2)
S[H+1]="#"*(W+2)
for h in range(1,H+1):
	s = input()
	S[h] = "#" + s + "#"

#p(S)

XY=[[1,0],[-1,0],[0,1],[0,-1]]

INF=float("inf") # 正の無限大
ans=0

from collections import deque

for h in range(1,H+1):
	for w in range(1,W+1):

		if S[h][w]=="#": continue

		M=[[ INF for w in range(W+2) ] for h in range(H+2)]
		M[h][w]=0

		Q = deque()
		Q.append([h,w])
		mmax=0

		#p("Q=",Q)
		
		while Q:
			h,w=Q.popleft()
			
			if S[h][w]=="#": continue
			
			m = M[h][w]
			mmax=max(mmax,m)
			for x,y in XY:
				if S[h+y][w+x]=="#": continue
				
				if M[h+y][w+x] > (m+1):
					M[h+y][w+x] = m+1
					Q.append([h+y,w+x])
					mmax=max(mmax,m+1)

			#p("h,w,Q,m=",h,w,Q,m)

		for MH in M:
			for m in MH:
				if m==INF: continue
				ans=max(ans,m)


#for m in M:
#	print(m)

print(ans)


Measured memory_bytes: 3316
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N;
    cin >> N;
    vector<ll> X(N);
    for(int i = 0; i < N; i++) cin >> X[i];
    vector<ll> Xc = X;
    sort(all(Xc));
    ll m_1 = Xc[N / 2 - 1], m_2 = Xc[N / 2];
    for(int i = 0; i < N; i++){
        if(X[i] <= m_1) cout << m_2 << endl;
        else cout << m_1 << endl;
    }

}

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

int main(){
	int n, k;
	cin >> n >> k;
	
	double ans = 0;
	rep(i, n){
		double p = 1;
		int x = i+1;
		while(x < k){
			p *= 0.5;
			x *= 2;
		}
		ans += p/n;
	}
	cout << fixed << setprecision(15) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
    int W, H, N;
    cin >> W >> H >> N;

    vector<set<int>> X(H + 1);
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        X[y].insert(x);
    }

    int ans = W;
    for (int y = 1, x = 1; y <= H; ++y) {
        if (y != 1) {
            x++;
        }
        while (1) {
            auto it = X[y].lower_bound(x);
            if (it != X[y].end() && *it == x) {
                ++x;
            } else {
                break;
            }
        }
        auto it = X[y].lower_bound(x);
        if (it != X[y].end()) {
            smin(ans, *it - 1);
        }
    }
    cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 19072
n, k = map(int, input().split())
a = list(map(int, input().split()))

flag = [0] * n
i = 0
loop = [1]
while True:
    i = a[i] - 1
    if flag[i] == 0:
        flag[i] = 1
        loop.append(i + 1)
    else:
        start = loop.index(i + 1)
        m = len(loop)
        length = m - start
        break

if k < m:
    print(loop[k])
else:
    k -= m - 1
    k = (k - 1) % length
    print(loop[start + k])

Measured memory_bytes: 32236
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main(void) {
  int a;
  string s;
  cin>>a;
  cin>>s;
  if (a >= 3200)
    std::cout << s << std::endl;
  else
    std::cout << "red" << std::endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int[] count = new int[2019];
        int mul = 1;
        int ans = 0;
        int tmp = 0;
        for (int i = s.length() - 1; i >= 0; i--) {
            // T (n+1) = T (n) + 10 * An
            tmp = (tmp + mul * (s.charAt(i) - '0')) % 2019;
            if (tmp == 0) ans++;
            ans += count[tmp];
            count[tmp]++;
            mul = mul * 10 % 2019;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 41052
import numpy as np
n=int(input())
xy=np.zeros((n,2))
for i in range(n):
    xy[i][0],xy[i][1]=map(int,input().split())

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans+=np.sqrt(np.square(xy[i][0]-xy[j][0])+np.square(xy[i][1]-xy[j][1]))
ans/=(n/2)
print(ans)

Measured memory_bytes: 12504
#include <stdio.h>

int main(){

	int N = 0, a=0, b=0, c=0,i;

	scanf("%d",&N);
	for (i = 0; i < N; i++){
		scanf("%d %d %d", &a, &b, &c);
		
		if (a*a + b*b == c*c){
			printf("YES\n");
		}
		else if (a*a + c*c == b*b){
			printf("YES\n");
		}
		else if (b*b + c*c == a*a){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
int main()	{
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n){
    cin>>a[i];}
  int al=0;
  int bo=0;
  sort(a.rbegin(),a.rend());
  rep(i,n){
    if(i%2==0)
    al+=a[i];
    else
    bo+=a[i];
  }
  int ans=abs(al-bo);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n,a,b,dp[5555][5555][2],sum[5555][5555][2],sm[5555],ans,pw;
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	if (a>b) swap(a,b);
	dp[0][0][0]=dp[0][0][1]=1;
	sum[0][0][0]=sum[0][0][1]=1;
	sm[0]=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=max(0,i-b+1);j<=i;j++)
		{
			for (int k=0;k<2;k++)
			{
				if (!k && i==j)
				{
					dp[i][j][k]=sm[i-1];
					if (i-a>=0) dp[i][j][k]=(dp[i][j][k]-sm[i-a])%mod;
				}
				else
				{
					if (!k)
					{
						if (i-a<0) dp[i][j][k]=0;
						else dp[i][j][k]=sum[i-a][j][1];
					}
					else
					{
						dp[i][j][k]=sum[i-1][j][0];
					}
				}
			}
		}
		sm[i]=sm[i-1];
		for (int j=0;j<=i;j++)
		{
			for (int k=0;k<2;k++)
			{
				sum[i][j][k]=(sum[i-1][j][k]+dp[i][j][k])%mod;
				if (k==1) sm[i]=(sm[i]+dp[i][j][k])%mod;
			}
		}
	}
	for (int i=n-b+1;i<=n;i++)
	{
		ans=(ans+dp[n][i][0])%mod;
		ans=(ans+dp[n][i][1])%mod;
	}
	pw=1;
	for (int i=1;i<=n;i++) pw=(pw+pw)%mod;
	ans=(pw-ans)%mod;
	printf("%d\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 239132
import sys
Vnum = 0
Enum = 0
Edge = {}
L = []
V = []

def visit(n):
    if V[n] == 1:
        print(1)
        sys.exit()
    elif V[n] == 0:
        V[n] = 1
        if n in Edge.keys():
            for m in Edge[n]:
                visit(m)
        V[n] = 2
        L.append(n)
        return True

Vnum,Enum = map(int,input().split())
V = [ 0 for v in range(Vnum) ]
for _ in range(Enum):
    s,t = map(int,input().split())
    if s in Edge.keys():
        Edge[s].append(t)
    else:
        Edge[s] = [t]

for n in range(Vnum):
    if V[n] == 0:
        visit(n)
L.reverse()
print(0)



Measured memory_bytes: 5612
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int main() {
    string S; cin>>S;
    int counter=0;
    int counter1=0;
    int counter2=0;
    int answer=0;
    int a=0;
    for(int i=0; i<S.size();i++){
    if(S.at(i)=='N')
    counter++;
    if(S.at(i)=='W')
    counter1++;
    if(S.at(i)=='S')
    counter2++;
    if(S.at(i)=='E')
    answer++;
    }
    if(counter==0){
    a++;}
    if(counter1==0){
    a++;}
    if(counter2==0){
    a++;}
    if(answer==0){
    a++;}
    if(a==3||a==1){
    cout<<"No"<<endl;}
    else
    if(counter==0||counter2==0||counter1==0||answer==0){
    if((counter==0&&counter2==0)||(counter1==0&&answer==0))
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;}
    
    else
    cout<<"Yes"<<endl;
}
    


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll n, x,g=0;
	bool isTooBig = true;
	in(n);
	in(x);

	vll a(n);
	for (auto& i : a) {
		in(i);
		g = gcd(g, i);
		if (i == x) {
			outn("POSSIBLE");
			return 0;
		}
		if (x < i) {
			isTooBig = false;
		}
	}
	if (isTooBig) {
		outn("IMPOSSIBLE");
		return 0;
	}

	for (auto& i : a) {
		if ((i - x) % g == 0) {
			outn("POSSIBLE");
			return 0;
		}
	}

	outn("IMPOSSIBLE");
	return 0;

}


Measured memory_bytes: 1024
use List::Util qw(max min);
    my ($a, $b, $c) = split(/\s+/, <>);
     
    my $max = max($a,$b);
    my $min = min($a,$b);
     
    if ($min <= $c && $c <= $max) {
        print "Yes\n";
    } else {
        print "No\n";
    }

Measured memory_bytes: 640
# coding=utf-8

###
### for python program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
# print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
# print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
# print(" {}".format(i), end="")

# def printA(A):
#     for i, n in enumerate(A):
#         print(n, end='')
#         if i != N-1:
#             print(' ', end='')
#     print()

# リスト内包表記 ifあり
# [x-k if x != 0 else x for x in C]

# ソート
# N = N.sort()

# 10000個の素数リスト
# P = mymath.pnum_eratosthenes(105000)

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
        except EOFError:
            break
    return N

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

def dist(A, B):
    d = 0
    for i in range(len(A)):
        d += (A[i]-B[i])**2            
    d = d**(1/2)
    return d

N = int(input())
ans = []

for i in range(N):
    s = input()
    ans.append(s.replace('Hoshino', 'Hoshina'))

for s in ans:
    print(s)




Measured memory_bytes: 5684
#include <cstdio>
int dfs(int n, int s, int cnt, int sum, int num) {
	int res = 0;
	if (cnt==n&&sum==s) return 1;
	else if (cnt==n) return 0;
	if (num==10) return 0;
	res += dfs(n, s, cnt+1, sum+num, num+1);
	res += dfs(n, s, cnt, sum, num+1);
	return res;
}
int main() {
	int n, s;
	while (scanf("%d%d",&n,&s)) {
		if (n==0&&s==0) break;
		int res = dfs(n, s, 0, 0, 0);
		printf("%d\n",res);
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, cost[30],m,a[100001],k,d;
vector<vector<ll>> v(39);
//-------------------関数----------------------//


int main() {
	cin >> n;
	ll gomi = 1,cnt=0;
	while (gomi <= n) { gomi *= 2; cnt++; }
	cout << gomi / 2 << endl;;
	return 0;
}

Measured memory_bytes: 256
import sys
s = list(input())
while(len(s) > 0):
    if (''.join(s[-5:]) == 'dream'):
        for i in range(5):
            s.pop()
    elif (''.join(s[-5:]) == 'erase'):
        for i in range(5):
            s.pop()
    elif (''.join(s[-6:]) == 'eraser'):
        for i in range(6):
            s.pop()
    elif (''.join(s[-7:]) == 'dreamer'):
        for i in range(7):
            s.pop()
    else:
        print('NO')
        sys.exit()
print('YES')
        







Measured memory_bytes: 9828
// Code for C - Ubiquity
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define MOD 1000000007
#define mod(x) ( (x) % MOD + MOD ) % MOD

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T, typename U> void view(const std::map<T, U>& m){ for(const auto& e : m){ std::cout << e.first << "=>" << e.second << " "; } std::cout << std::endl; }

const int MAX = 1000000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll sub(ll a,ll b) {
  return (a + MOD - b) % MOD;
}

int main() {
  COMinit();

  int N;
  cin >> N;

  if (N == 1) {
    cout << "0" << endl;
    return 0;
  }

  ll total = 1;
  REP(i, N) {
    total = ( total * 10 ) % MOD;
  }

  ll x0 = 1;
  REP(i, N) {
    x0 = ( x0 * 9 ) % MOD;
  }

  ll x9 = 1;
  REP(i, N) {
    x9 = ( x9 * 9 ) % MOD;
  }

  ll x09 = 1;
  REP(i, N) {
    x09 = ( x09 * 8 ) % MOD;
  }

  cout << ((sub(sub(total, x0), x9) + x09) % MOD) << endl;
  return 0;
}


Measured memory_bytes: 27060
N = int(input())
trans_list = []
for _ in range(5):
    trans_list.append(int(input()))

min_trans = [min(trans_list),trans_list.index(min(trans_list))]

if min_trans[0]>=N :
    print(5)
else:
    syou, amari = divmod(N,min_trans[0])
    if amari !=0 :
        print(syou+1+4)
    else:
        print(syou+4)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	int n,p;
	while(cin>>n>>p,n){
		int d[n],t=0,cnt=p;
		for(int i=0;i<n;i++)
		d[i]=0;
		while(1){
			if(d[t]==p)
			break;
			if(cnt==0){
				cnt=d[t];
				d[t]=0;
			}else{
				cnt--;
				d[t]++;
			}
			t++;
			if(t==n)
			t=0;
		}
		cout<<t<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

A, B, K = LI()

for k in range(K):
    if k % 2 == 0:
        if A % 2 == 1:
            A -= 1
        c = A // 2
        A -= c
        B += c
    else:
        if B % 2 == 1:
            B -= 1
        c = B // 2
        B -= c
        A += c
    
print(A, B)


Measured memory_bytes: 10688
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

int main() {
	string s;
	cin >> s;
	int w;
	cin >> w;
	REP(i,s.length()){
		if(i%w==0) cout << s[i];
	}
	
	
	return 0;
}

Measured memory_bytes: 256
def makeRelation():
  visited=[False]*(N+1)
  g=0 # group
  for n in range(1,N+1):
    if visited[n]:
      continue
    q={n}
    D.append(set())
    while q:
      j=q.pop()
      for i in F[j]: # search for friend
        if not visited[i]:
          visited[i]=True
          q.add(i)
          D[g]|={i}
    g+=1
    
def main():
  makeRelation()
  #print(D)
  for g in D:
    for d in g:
      ans[d]=len(g) - len(F[d]) - len(g&B[d]) - 1
  print(*ans[1:])


if __name__=='__main__':
  N, M, K = map(int, input().split())
  F=[set() for n in range(N+1)]
  AB=[list(map(int, input().split())) for m in range(M)]
  for a,b in AB:
    F[a].add(b)
    F[b].add(a)
  B=[set() for n in range(N+1)]
  CD=[list(map(int, input().split())) for k in range(K)]
  for c,d in CD:
    B[c].add(d)
    B[d].add(c)
  D=[]
  #print(F)
  #print(B)
  ans=[0]*(N+1)
  main()

Measured memory_bytes: 146380
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


inline double inp(const P &a, const P &b) {
	return (conj(a) * b).real();
}

inline double outp(const P &a, const P &b) {
	return (conj(a) * b).imag();
}

P circumc(const P &a, const P &b, const P &c) {
	return (a + b - (inp(c - b, a - c) / outp(b - a, c - b)) * (b - a) * P(0, 1)) / 2.0;
}

int main(){
	int n; cin >> n;
	while (n--) {
		double x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		P p1(x1, y1), p2(x2, y2), p3(x3, y3);
		P c = circumc(p1, p2, p3);
		printf("%.3f %.3f %.3f\n", c.real(), c.imag(), abs(p1 - c));
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final long answer = LongStream.rangeClosed(1, scanner.nextInt())
                .filter(i -> i % 3 != 0 && i % 5 != 0)
                .sum();
        System.out.println(answer);
    }
}


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

int main(){
  string s;cin>>s;
  int n=s.size(),ans=1,count=0;
  if(s.at(0)!='A') ans=0;
  for(int i=2;i<n-1;i++) if(s.at(i)=='C') count++;
  if(count!=1) ans=0;
  for(int i=1;i<n;i++) if((s.at(i)<'a'||s.at(i)>'z')&&s.at(i)!='C') ans=0;
  cout<<(ans?"AC":"WA");
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    string s; cin>>s;
    bool valid = true;
    for(int i=0; i<s.size(); i++){
        if(i % 2 == 0){
            if(s[i] == 'L') valid = false;
        }
        else{
            if(s[i] == 'R') valid = false;
        }
    }

    if(valid) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
int main() {
  ll n,k;
  cin>>n>>k;
  ll a[n],b[n];
  for(ll i=0;i<n;i++) {cin>>a[i]>>b[i];}
  ll dp[n+1][k+1];
  for(int i=0;i<=n;i++) {
    for(int j=0;j<=k;j++) {
      if(i==0 || j==0) {dp[i][j]=0;}
      else if(j>=a[i-1]) {dp[i][j]=max(b[i-1]+dp[i-1][j-a[i-1]],dp[i-1][j]);}
      else {dp[i][j]=dp[i-1][j];}
    }
  }
  cout<<dp[n][k]<<endl;
return 0;
}


Measured memory_bytes: 82512
A, B, K = map(int, input().strip().split(" "))
# print(A, B, K)

if A > K:
    A -= K
    K = 0

else:
    K -= A
    A = 0

if B > K:
    B -= K
    K = 0

else:
    B = 0
    
print("{} {}".format(A, B))

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

int main()
{
    ll a, b, c, d, n1, n2;

    cin >> a >> b >> c >> d;
    n1 = c / b + (c % b == 0 ? 0 : 1);
    n2 = a / d + (a % d == 0 ? 0 : 1);

    cout << (n1 > n2 ? "No" : "Yes") << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define pr(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define Toggle(n,i) (n^(1<<i))
#define Check(n,i) (n&(1<<i))
#define Set(n,i) (n|(1<<i))
#define Reset(n,i) (n&(~(1<<i)))
#define fo(a,x,y) for(int i=(x);i<=(y);++i){cout<<a[i]<<" ";}cout<<endl;
#define me(arr,val) memset(arr,val,sizeof arr)
#define inf 10e8
#define infd DBL_MAX
#define infl LLONG_MAX
#define mod 1000000007ll
#define f first
#define s second
#define  g(t,a)  (get<a>(t))
#define pra(a) for(auto i:a){cout<<i<<endl;}
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//int dx[]={+1,-1,0,0};//vertical horizontal
//int dy[]={0,0,+1,-1};//vertical horizontal
//int dx[]={+1,+1,-1,-1,+2,-2,+2,-2};//knights move
//int dy[]={+2,-2,+2,-2,+1,+1,-1,-1};//knights move
//int dx[]={+1,-1,0,0,+1,+1,-1,-1};//vertical horizontal diagonal
//int dy[]={0,0,+1,-1,-1,+1,+1,-1};//vertical horizontal diagonal
using namespace std;
using namespace __gnu_pbds;
/*typedef tree<int, null_type,less<int>, rb_tree_tag,
             tree_order_statistics_node_update>indexed_set;
for set use above*/
typedef tree<pair<int,int>, null_type,less<pair<int, int>>, rb_tree_tag,
tree_order_statistics_node_update> indexed_multiset;


int main()
{
    ll n,ans=1,pow10=1,pow9=1,pow8=1;
    cin>>n;
    for(ll i=1;i<=n;++i)
    {
        pow10=(pow10*10)%mod;
    }
    for(ll i=1;i<=n;++i)
    {
        pow8=(pow8*8)%mod;
    }
    for(ll i=1;i<=n;++i)
    {
        pow9=(pow9*9)%mod;
    }
    ans=(pow10+pow8-(2*pow9)%mod+mod)%mod;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
int main()
{
	int m;
	while(scanf("%d",&m)!=EOF){
		if(m==25){
			printf("Christmas\n");
		}else if(m==24){
			printf("Christmas Eve\n");
		}else if(m==23){
			printf("Christmas Eve Eve\n");
		}else if(m==22){
			printf("Christmas Eve Eve Eve\n");
		}
		
		
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

int log3(int N){
    int ret=0;
    while(N>=3){
        N/=3;
        ret++;
    }
    return ret;
}

void cout_vec(vector<int> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int L;
    cin >> L;
    int goal=L;
    L--;

    int num=13;
    vector<int> pow3(21,1);
    for(int i=0; i<num; i++){
        pow3[i+1]=pow3[i]*3;
    }

    int n=log3(L+1);
    vector<vector<int> > path(0);
    for(int i=1; i<num; i++){
        path.push_back({i, i+1, 0});
    }

    int base=1;
    for(int i=0; i<n; i++){
        for(int j=1; j<3; j++){
            path.push_back({i+1, i+2, j*base});
        }
        base*=3;
    }

    L-=base;
    while(base!=goal){
        n=log3(L+1);
        path.push_back({n+1,num,base});
        base+=pow3[n];
        L-=pow3[n];
    }

    cout << num << ' ' << (int)path.size() << endl;
    for(auto &p:path){
        cout_vec(p);
    }
}

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

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vl> graph;

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

    int n, a, b;
    cin >> n >> a >> b;
    int total = 0;
    total += (n - a + 1) * (n - b + 1);
    cout << total << "\n";
    return 0;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    ll n, m; 
    cin >> n >> m;

    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<ll> sum(n + 1, 0);
    for(int i = 0; i < n; i++){
        sum[i + 1] = sum[i] + a[i];
    }

    map<ll,ll> mp;
    for(int i = 0; i <= n; i++){
        mp[sum[i] % m]++;
    }
    ll ans = 0;

    for(auto &i : mp){
        if(i.second < 2) continue;
        if(i.first == 0){
            ans += nCr(i.second, 2LL);
        } else {
            ans += nCr(i.second, 2LL);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 5760
use proconio::input;

fn main() {
    input!(n: usize, a: [usize; n]);

    const AMAX: usize = 1_000_000;

    let mut cnt = vec![0; AMAX + 1];
    for &a in &a {
        cnt[a] += 1;
    }

    let mut seen = vec![false; AMAX + 1];
    let mut max_csum = 0;
    for i in 2..=AMAX {
        if seen[i] {
            continue;
        }
        let csum = (i..=AMAX)
            .step_by(i)
            .map(|j| {
                seen[j] = true;
                cnt[j]
            })
            .sum();
        max_csum = max_csum.max(csum);
    }

    let pairwise = max_csum <= 1;
    let setwise = max_csum < n;

    println!(
        "{}",
        if pairwise {
            "pairwise coprime"
        } else if setwise {
            "setwise coprime"
        } else {
            "not coprime"
        }
    );
}


Measured memory_bytes: 25224
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory>
#include<cmath>
#include<algorithm>
#include<vector>
double min_double(double a,double  b){
    if(a<b) return a;
    else return b;
}
void swap(int *x,int *y){
    int tmp;
    tmp=*x;
    *x=*y;  
    *y=tmp;
}
int gcd(int a,int b){
    if(a<b) swap(&a,&b);
    if(b<1) return -1;

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

int main(){
    int L,R;
    std::cin>>L>>R;
    if(R - L + 1 >= 2019){
        std::cout<<0<<std::endl;
        return 0;
    }

    int num = R - L + 1;
    int min=2019;
    for(long i=L;i<=R;i++){
        for(long j=i+1;j<=R;j++){
            int cal=(i * j)%2019;
            if(cal < min) min = cal;
        }
    }

    std::cout<<min<<std::endl;

    return 0;
}



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

int main(){
    int n,m,votes = 0,i,cnt = 0;
    cin>>n>>m;
    int t[n];
    for(i = 0;i<n;++i){
        cin>>t[i];
        votes += t[i];
    }
    i = 0;
    cnt = 0;  
    int cmp = ceil((double)votes/(4*m));
      
    while(cnt<m && i<n){
        if(t[i]>=cmp){
            cnt++;
        }
        i++;
    }
    if(cnt == m){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3624
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define deb(x) cout<<#x<<' '<<x<<endl;
#define pb push_back

/*
#ifdef IZI_KATKA
#define int __int64_t
#else
#define int __int64
#endif
*/

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus1)
        return -result;
    else
        return result;
}

int p[MAXN];
int pos[MAXN];


int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    int n = readInt();
    for (int i = 1; i <= n; i++) {
    	p[i] = readInt();
    	pos[p[i]] = i;
    }
    for (int i = 1; i <= n; i++) {
    	cout << i * 30000 << ' ' ;
    }
    cout << endl;
    for (int i = 1; i <= n; i++) {
    	cout << (n - i) * 30000 + pos[i] << ' ';
    }
    return 0;
}

Measured memory_bytes: 2688
#include <iostream>
#include<bits/stdc++.h>
#define rep(k,i,n) for(int i=k;i<n;++i)
using namespace std;
int main(void){
    // Your code here!
    string S;
    cin>>S;
    if(S=="Sunny"){
        cout<<"Cloudy"<<endl;
    }else if(S=="Cloudy"){
        cout<<"Rainy"<<endl;
    }else{
        cout<<"Sunny"<<endl;
    }
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {
	

	
	
	public static void main(String[] args) {

		
		Scanner s = new Scanner(System.in);
		
		int n = s.nextInt();
		int m = s.nextInt();
		
		int sum=0;
		for(int i=0;i<m;i++) {
			sum+=s.nextInt();
		}
		if(sum>n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n-sum);
		}
		
	}
}

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

int main(){
  int a,b;
  cin>> a>> b;
  if(b%a == 0) cout << a+b << endl;
  else cout << b-a << endl;
  return 0;
}


Measured memory_bytes: 256
from itertools import *
N,K = map(int,input().split())
D = list(map(int,input().split()))

num = []

for i in range(10):
  if i not in D:
    num.append(str(i))
ans = 10**18
for i in product(num,repeat=len(str(N))):
  money = int(''.join(list(i)))
  if N <= money :
    ans = min(ans,money)
if ans == 10**18:
  for i in product(num,repeat=len(str(N))+1):
    money = int(''.join(list(i)))
    if N <= money :
      ans = min(ans,money)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n;
    cin >> n;
    double a[n],b[n];
    int m=1;
    for(int i=1;i<=n;i++){
        cin >> a[i] >> b[i];
        m*=i;
    }
    int dp[n+1];
    for(int i=1;i<=n;i++){
        dp[i]=i;
    }
    double sum=0;
    do{
        for(int i=1;i<=n-1;i++){
             int x=a[dp[i]]-a[dp[i+1]];
              int y=b[dp[i]]-b[dp[i+1]];
              sum+=sqrt((x*x)+(y*y));
        }
    }
    while(next_permutation(dp+1,dp+n+1));
    printf("%.10f\n",sum/m);

}



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

int main(){
  string T,S;
  int i,j,k;
  
  cin >> S >> T;
  
  int res = T.size();
  for(i=0;i<=S.size()-T.size();i++){
    k=0;
    for(j=0;j<T.size();j++)
      if (S[i+j] != T[j])
        k++;
    res = min(res,k);
  }
  
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 3596
a, b = map(int, input().split())
s = list(input())
c = 0
for i in range(a + b):
    if i == a and s[i] != "-":
        c = 1
    if i != a and s[i] == "-":
        c = 1
if c == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
S = list(input())

count = 0

# print(S)

if S[0] == 'R' and S[1] == 'R' and S[2] == 'R':
    print(3)
    exit()
if S[0] == 'R' and S[1] == 'S' and S[2] == 'R':
    print(1)
    exit()
if S[0] == 'R' and S[1] == 'R' and S[2] == 'S':
    print(2)
    exit()
if S[0] == 'S' and S[1] == 'R' and S[2] == 'R':
    print(2)
    exit()
if S[0] == 'S' and S[1] == 'S' and S[2] == 'S':
    print(0)
    exit()
if S[0] == 'S' and S[1] == 'R' and S[2] == 'S':
    print(1)
    exit()
if S[0] == 'S' and S[1] == 'S' and S[2] == 'R':
    print(1)
    exit()
if S[0] == 'R' and S[1] == 'S' and S[2] == 'S':
    print(1)
    exit()



Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

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

	int x, y;
	cin >> x >> y;
	if (abs(x - y) > 1) {
		cout << "Alice\n";
	} else {
		cout << "Brown\n";
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <bits/stdc++.h>
#include<vector>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
  int k;
  string s,subs;
  cin >> k;
  cin >> s;
  if((int)(s.size()) <= k){
    cout << s << endl;
  }else{
    subs = s.substr(0,k);
    cout << subs + "..." << endl;
  }
}


Measured memory_bytes: 3600
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using vi = vector<int>;
using vl = vector<int64_t>;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64_t INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

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

  for (int i = 1; i < n; ++i) {
    if (a[i] - 1 >= a[i - 1]) {
      --a[i];
    }
  }

  for (int i = 0; i < n - 1; ++i) {
    if (a[i] > a[i + 1]) {
      print("No"); return 0;
    }
  }

  print("Yes");

  return 0;
}

Measured memory_bytes: 640