akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main()
{
    char s[20];
    if (scanf("%s", s) != 1) {
        printf("Failed to read strings.\n");
        return -1;
    }

    int i = 0;
    while (i < strlen(s)) {
        if (s[i] == ',') {
            s[i] = ' ';
        }
        i = i + 1;
    }

    printf("%s", s);
    
    return 0;
}

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

const int MOD = 1e9 + 7;
const int MAX = 2e5 + 10;

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;
}

int main() {
    int N, M, K; cin >> N >> M >> K;
    long long ans = 0;
    COMinit();
    for (int i = 1; i < M; i++) {
        ans = (ans + ((((COM(N*M-2, K-2) * (M - i) % MOD) * N % MOD) * N % MOD) * i % MOD)) % MOD;
    }
    for (int i = 1; i < N; i++) {
        ans = (ans + ((((COM(N*M-2, K-2) * (N - i) % MOD) * M % MOD) * M % MOD) * i % MOD)) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <type_traits>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define all(n) std::begin(n), std::end(n)
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;


void calc() {

	Int X; std::cin >> X;
	Int ans = 0, money = 100;
	while (money < X) {
		ans++;
		double tmp = (double)money * 1.01;
		money = (Int)tmp;
	}

	std::cout << ans;

}


int main() {

	calc();

	return 0;
}

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

using namespace std;

int main() {
    int n, d;
    cin >> n >> d;
    vector<vector<int> > X(n, vector<int>(d));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            cin >> X[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            double distance = 0;
            for (int k = 0; k < d; ++k) {
                distance += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            distance = sqrt(distance);
            if (ceil(distance) == floor(distance)) ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    char A[11],B[11],C[11];
    cin>>A>>B>>C;
    if(A[strlen(A)-1]==B[0] && B[strlen(B)-1]==C[0])
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

}


Measured memory_bytes: 3556
from collections import deque

n = int(input())

result = deque()
index = 0

if n % 2 == 0:
    for i in input().split():
        if index % 2 == 1:
            result.appendleft(i)
            index += 1
        else:
            result.append(i)
            index += 1
else:
    for i in input().split():
        if index % 2 == 1:
            result.append(i)
            index += 1
        else:
            result.appendleft(i)
            index += 1

print(" ".join(result))

Measured memory_bytes: 26568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,ans=0;cin>>n;
  lvector A(n,0),B(n,0);
  rep(i,n) cin>>A[i]>>B[i];
  ll pos=n-1,res=0;
  while(pos>-1) {
    res=(A[pos]+ans)%B[pos];
    if(res!=0) ans+=B[pos]-res;
    pos--;
  }
  print(ans);
  return 0;
}

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

int main(){
  int i,l,c;
  string S,T;
  cin >> S >> T;
  l = S.size();
  i=0;
  c=0;
  while(i<l){
    if(S[i]!=T[i]){
      c++;
    }
    i++;
  }
  cout << c <<endl;
}

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

using namespace std;
typedef long long ll;

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

    if(n == 1) {
        if(m == 1) return !printf("1\n");
        else if(m == 2) return !printf("0\n");
        else return !printf("%d\n", m - 2);
    }
    
    return !printf("%lld\n", 1LL * (n - 2) * (m - 2));
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

public class Main implements Runnable {

    public static void main(String[] args) throws Exception {
        Thread.setDefaultUncaughtExceptionHandler((t, e)->System.exit(1));
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        int N = 0;
        int[] prices = new int[10010];
        
        // 入力
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            // プレゼントの個数
            N = Integer.parseInt(br.readLine());
            // プレゼントの値段を配列に読み込む
            for (int i = 0; i < N; i++) {
                prices[i] = Integer.parseInt(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 先頭から足していく
        // 最大値も調べて、最後に最大値の半分を引く
        int result = prices[0];;
        int max = prices[0];
        for (int i = 1; i < N; i++) {
            // プレゼントの値段を足していく
            result += prices[i];
            // 最も高いプレゼントの値段を調べる
            if (max < prices[i]) {
                max = prices[i];
            }
        }
        // 最も高いプレゼントの半額を引く
        result = result - max / 2;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 28500
//#define _GLIBCXX_DEBUG
//#include "atcoder/all"
//using namespace atcoder;
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) (((n) >> (k)) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

int N;
int A[202020], B[202020], cntA[202020], cntB[202020];


void solve() {
    bool flag = true;
    for (int i = 0; i <= N; i++) {
        if (cntA[i] + cntB[i] > N)
            flag = false;
    }
    Yes(flag);
    if (!flag)
        return;

    int cnt = 0;
    int s1 = 0, s2 = 0;
    for (int i = 1; i <= N + 1; i++) {
        chmax(cnt, s1 - s2);
        s1 += cntA[i];
        s2 += cntB[i - 1];
    }
    for (int i = 0; i < N; i++) {
        cout << B[(i + N - cnt) % N] << " ";
    }
    cout << endl;
}

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

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        cntA[A[i]]++;
    }
    for (int i = 0; i < N; i++) {
        cin >> B[i];
        cntB[B[i]]++;
    }

    solve();
    return 0;
}


Measured memory_bytes: 9884
#include <bits/stdc++.h>
using namespace std;
int ct[2005];
int distx[2005], disty[2005];
int main(){
    int n,x,y;
    scanf("%d%d%d",&n,&x,&y);
    for (int i = 1; i <= n; i++){
        distx[i] = abs(i-x);
        disty[i] = abs(i-y);
    }
    for (int i = 1; i <= n; i++){
        for (int j = i+1; j <= n; j++){
            int dist = j-i;
            dist = min(dist,distx[i]+distx[j]);
            dist = min(dist,disty[i]+disty[j]);
            dist = min(dist,distx[i]+disty[j]+1);
            dist = min(dist,disty[i]+distx[j]+1);
            //printf("%d %d %d\n",i,j,dist);
            ct[dist]++;
        }
    }
    for (int i = 1; i < n; i++){
        printf("%d\n",ct[i]);
    }

}


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

int minnum(int a, int b){
	if(a>b)	return b;
	else return a;
}

int main(void){
	long long int a,b;
	long long int saisyo;
	scanf("%lld %lld", &a, &b);
	for(int i=minnum(a,b);i>=1;i--){
		if(a%i==0 && b%i==0){
			saisyo=(long long int)i;
			break;
		}
	}
	printf("%lld", a*b/saisyo);

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007

using namespace std;
int findNumberOfTriangles(int arr[], int n)
{
    // Count of triangles
    int count = 0;

    // The three loops select three
    // different values from array
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {

            if (arr[i] == arr[j])
                continue;
            for (int k = j + 1; k < n; k++)
            {
                if (arr[i] == arr[k] || arr[j] == arr[k])
                    continue;
                if (
                    arr[i] + arr[j] > arr[k] && arr[i] + arr[k] > arr[j] && arr[k] + arr[j] > arr[i])
                    count++;
            }
        }
    }
    return count;
}
int main()
{
#ifdef WIN32
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    cout << findNumberOfTriangles(arr, n) << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;


int main() {
    fast

    long long n,r;
    cin>>n>>r;

    if(n>=10)cout<<r;
    else{
        cout<<r+(100*(10-n));
    }


	return 0;
}


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

using namespace std;
using lint = long long;

int main() {
    lint N;
    cin >> N;
    vector<lint> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    lint ans = 0;
    while (true) {
        sort(a.begin(), a.end(), greater<lint>());

        lint num = a[0]/N;
        ans += num;

        a[0] %= N;
        for (int i = 1; i < N; i++) {
            a[i] += num;
        }

        if (a[1] < N) {
            break;
        }
    }

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

Measured memory_bytes: 256
local s = io.read()
local ret = 0
local cura = 0
local n = #s
local i = 1
while i <= n do
  local ss = s:sub(i, i)
  if ss == "A" then
    cura = cura + 1
    i = i + 1
  elseif ss == "B" then
    if i < n and s:sub(i + 1, i + 1) == "C" then
      ret = ret + cura
      i = i + 2
    else
      cura = 0
      i = i + 1
    end
  else
    cura = 0
    i = i + 1
  end
end
print(ret)


Measured memory_bytes: 1016
x = int(input())

data =[]
data_dict ={}
data_dict['S'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13]
data_dict['H'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13]
data_dict['C'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13]
data_dict['D'] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13]

for i in range(x):
    a, b = input().split()
    
    for i in data_dict[a]:
        if i == int(b):
            data_dict[a].remove(i)
       
for n in data_dict['S']:
    print('S',n)
    
for m in data_dict['H']:
    print('H', m)

for l in data_dict['C']:
    print('C', l)

for k in data_dict['D']:
    print('D', k)
        


Measured memory_bytes: 5612
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <list>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
    


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

    list<int> v;
    for(int i = 0; i < s.size() - 1; i++ ){
        if(s[i] == 'B' && s[i + 1] == 'C'){
            v.push_back(1);
            i ++ ;
        }
        else if(s[i] == 'A'){
            v.push_back(0);
        }
        else v.push_back(-1);
    }
    if(s.back() == 'A') v.push_back(0);

    ll ans = 0;
    ll tmpA = 0;
    while(!v.empty()){
        if(v.front() == 1){
            ans += tmpA;
        }
        if(v.front() == 0){
            tmpA ++;
        }
        if(v.front() == -1){
            tmpA = 0;
        }
        v.pop_front();
    }
    cout << ans << endl;

}

Measured memory_bytes: 6660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()





int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep (i, n) {
        cin >> a[i];
    }
    vector<int> bs(n, -1);
    int trend = 0;
    bs[0] = 0;
    rep (i, n-1) {
        if (trend == 0 && a[i] > a[i+1]) {
            trend = 1;
            bs[i] = 1;
        } else if (trend == 1 && a[i] < a[i+1]) {
            trend = 0;
            bs[i] = 0;
        }
    }
    ll money = 1000;
    ll stock = 0;
    ll max_money = 1000;
    rep (i, n) {
        if (bs[i] == 0) {
            stock = money / a[i];
            money = money % a[i];
        } else if (bs[i] == 1) {
            money += stock * a[i];
            stock = 0;
        }
        chmax(max_money, money);
    }
    if (stock) {
        money += stock * a[n-1];
    }
    chmax(max_money, money);
    ll ans1 = max_money;
    rep (i, n) {
        bs[i] = -1;
    }
    trend = 1;
    bs[0] = 1;
    rep (i, n-1) {
        if (trend == 0 && a[i] > a[i+1]) {
            trend = 1;
            bs[i] = 1;
        } else if (trend == 1 && a[i] < a[i+1]) {
            trend = 0;
            bs[i] = 0;
        }
    }
    money = 1000;
    stock = 0;
    max_money = 1000;
    rep (i, n) {
        if (bs[i] == 0) {
            stock = money / a[i];
            money = money % a[i];
        } else if (bs[i] == 1) {
            money += stock * a[i];
            stock = 0;
        }
        chmax(max_money, money);
    }
    if (stock) {
        money += stock * a[n-1];
    }
    chmax(max_money, money);
    ll ans2 = max_money;
    cout << max(ans1, ans2) << endl;
}



Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define m 1000000007
using namespace std;
int h,w;
vector<vector<char>> g(1000,vector<char>(1000));
vector<vector<int>> dp(1000,vector<int>(1000,0));
long long grid(int i,int j){
    if(i<0 or j<0)return 0;
    if(i==0 &&j==0)return 1;
    if(g[i][j]=='#')return 0;
    if(dp[i][j]!=-1)return dp[i][j];
    dp[i][j] = grid(i-1,j)+grid(i,j-1);
    return dp[i][j]%m;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>h>>w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>g[i][j];
        }
    }
    for(int i=0;i<h;i++){
        if(g[i][0]=='#')
            break;
        else 
            dp[i][0]=1;
    }
    for(int i=0;i<w;i++){
        if(g[0][i]=='#')
            break;
        else 
            dp[0][i]=1;
    }
    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(g[i][j]=='#'){
                dp[i][j] = 0;
            }else{
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%m;
            }
        }
    }
    cout<<dp[h-1][w-1]<<"\n";
    return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
 using namespace std;
 #define endl '\n'
 #define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
 #define min3(a,b,c) min(a,min(b,c))
 #define max3(a,b,c) max(a,max(b,c)) 
 #define all(v) (v).begin(),(v).end()
 typedef long long ll;
 typedef unsigned long long llu;
 const double PI = 2*acos(0.0);
 const int MAXN = 100005;
 signed main()
 {
 	//freopen("","r",stdin);
 	//freopen("","w",stdout);
 	ios_base::sync_with_stdio(0);
 	cin.tie(0);
 	cout.tie(0);
 	int n;
 	cin>>n;
 	int res = INT_MAX;
 	for(int a=1;a<=MAXN;a++)
 	{
 		int b = n-a;
 		if(b>0)
 		{
 			int sum = 0;
 			int a1 = a;
 			while(a1)
 				sum+=(a1%10),a1/=10;
 			while(b)
 				sum+=(b%10),b/=10;
 			if(sum<res)res=sum;
 		}
 	}
 	cout<<res<<endl;
 	return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }


int main() {
    ll n,a,b,ans = 0;
    cin >> n >> a >> b;
    if(a == 0 && b == 0){
        cout << 0 << endl;
        return 0;
    }
    ll tmp = n/(a+b),amari;
    ans = tmp*a;
    amari = n%(a+b);
    if(a > amari) ans += amari;
    else ans += a;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll;
int main () {
  
  int N ;
  cin >> N ;
  ll a[N],b[N] ,tot = 0;
  for(int i = 0 ; i < N + 1 ;i++){
    cin >> a[i] ;
    tot+=a[i];
  }
  for(int i = 0 ; i < N ;i++)
    cin >> b[i] ;
  for(int i = 0; i < N ; i++)
  {
    ll t = min(a[i],b[i]) ;
    a[i]-=t;b[i]-=t ;
    t = min(b[i],a[i+1]);
     a[i+1]-=t;b[i]-=t ;
  }
  ll sum =0 ;
  for(int i=0 ; i < N + 1;i++)
    sum+=a[i];
  cout<<tot-sum<<endl;
    
 
  return 0;
}

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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


signed main(){
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    for(int i = 0; i < n; ++i){
        int id = s[i] - 'a';
        int id_pr = (id == 0 ? 0 : 26 - id);
        if(id_pr <= k){
            s[i] = 'a';
            k -= id_pr;
        }
    }
    s.back() = (s.back() - 'a' + k) % 26 + 'a';
    cout << s << endl;
}


Measured memory_bytes: 3708
n=int(input())
x,y=0,0
t=0
for i in range(n):
    T,X,Y=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 74576
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    if (n % 2 != 0)
    {
        cout << "No" << endl;
        return 0;
    }

    string s;
    cin >> s;

    const int m = n / 2;
    string p1 = s.substr(0, m);
    string p2 = s.substr(m, m);
    if (p1 == p2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define max(i,j) (i>j?i:j)

int main(void){
    int n,m,l,ans,cnt;
    char s[1000001],o[3]="IO";
    for(;;){
        scanf("%d",&n);
        if(n==0)break;
        scanf("%d%s",&m,s);
        l=2*n+1;
        ans=0;
        for(int i=0;i<m;i++){
            int j=0;
            cnt=0;
            while(i+j<m && s[i+j]==o[j%2]){
                cnt++;j++;
            }
            while(cnt>=l){
                ans++;
                cnt-=2;
            }
            //printf("%d %d\n",i,j);
            i+=max(j-1,0);
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 2008
#include <bits/stdc++.h>
using namespace std;
int main () {
  int n;cin >> n;int p[n];
  for(int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  for(int i = 1; i < n - 1; i++) {
    if((p[i - 1] < p[i]) && (p[i] < p[i + 1])) ans++;
    else if((p[i - 1] > p[i]) && (p[i] > p[i + 1])) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}

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

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

using namespace std;
using ll = int64_t;

constexpr int INF = (1 << 30);
constexpr ll INFL = (1LL << 62);
constexpr ll MOD = 1000000007;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};

//
// 重み付きUnion-Find Tree size version
//
// verify: AOJ DSL_1_B
//
template <typename T>
struct WeightedUnionFind {
    std::vector<int> data;
    std::vector<T> ws;
    const int n;
    WeightedUnionFind(int num) : data(num, -1), ws(num), n(num) {}
    int find(int k) {
        assert(0 <= k && k < n);
        if (data[k] < 0) return k;
        auto par = find(data[k]);
        ws[k] += ws[data[k]];
        return data[k] = par;
    }
    T weight(int k) {
        assert(0 <= k && k < n);
        find(k);
        return ws[k];
    }
    bool unite(int x, int y, T w) {
        assert(0 <= x && x < n);
        assert(0 <= y && y < n);
        w += weight(x);
        w -= weight(y);
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (data[x] > data[y]) {
            std::swap(x, y);
            w *= -1;
        }
        data[x] += data[y];
        data[y] = x;
        ws[y] = w;
        return true;
    }
    int size(int k) {
        assert(0 <= k && k < n);
        return (-data[find(k)]);
    }
    T diff(int x, int y) {
        assert(0 <= x && x < n);
        assert(0 <= y && y < n);
        return weight(y) - weight(x);
    }
};

int main() {
    cout << std::fixed << std::setprecision(10);
    int n, m;
    cin >> n >> m;
    WeightedUnionFind<int> uf(n);
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l;
        --r;
        if (uf.find(l) == uf.find(r)) {
            if (d != uf.diff(l, r)) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            uf.unite(l, r, d);
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1024
class UnionFind():
    def __init__(self, n):
        self.par = [i for i in range(n + 1)]
        self.rank = [0]*(n + 1)

    def root(self, x):
        if self.par[x] == x:
            return x
        r = self.root(self.par[x])
        self.par[x] = r
        return r

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

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if rx == ry:
            return
        if self.rank[rx] < self.rank[ry]:
            self.par[x] = ry
            self.par[rx] = ry
        else:
            self.par[y] = rx
            self.par[ry] = rx
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

def main():
    N, M, *AB = map(int, open(0).read().split())
    uf = UnionFind(N)
    elems = [1] * (N + 1)
    ans = N * (N - 1) // 2
    ANS = [0]*M
    for i in range(M):
        # print(ans)
        ANS[M - i - 1] = ans
        a = AB[2 * M - i * 2 - 2 + 0]
        b = AB[2 * M - i * 2 - 2 + 1]
        ra = uf.root(a)
        rb = uf.root(b)
        uf.unite(ra, rb)
        r = uf.root(ra)
        if ra != rb:
            era = elems[ra]
            erb = elems[rb]
            ans -= era * erb
            elems[r] = era + erb
    print('\n'.join(map(str, ANS)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 25732
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
 
 
public class Main {
 
    private static final int BIG_NUM  = 2000000000;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        long sum = 0;
        int minimum = BIG_NUM,maximum = -BIG_NUM;
 
        try {
 
            int N = Integer.parseInt(br.readLine());
 
            String first[] = br.readLine().split("[\\s]+");
            int array[] = new int[first.length];
 
            for(int i = 0; i < first.length; i++){
 
                array[i] = Integer.parseInt(first[i]);
                minimum = Math.min(minimum, array[i]);
                maximum = Math.max(maximum, array[i]);
                sum += array[i];
            }
 
            System.out.printf("%d %d %d\n",minimum,maximum,sum);
 
        } catch (IOException e) {
            e.printStackTrace();
        }
 
    }
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int n, m, k;
vector<int> v[101010], vv[101010];
//union-find
struct UnionFind {
	vector<int> par, depth, sz;
	UnionFind(int n) : par(n+1), depth(n+1), sz(n+1){
		for(int i = 0; i <= n; i++){
			par[i] = i;
			depth[i] = 0;
			sz[i] = 1;
		}
	}
	int find(int x){
		if(par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		sz[x] += sz[y];
		sz[y] = sz[x];
		if(depth[x] < depth[y]){
			par[x] = y;
		}
		else{
			par[y] = x;
			if(depth[x] == depth[y]) depth[x]++;
		}
	}
	bool same(int x, int y){
		return find(x) == find(y);
	}
	int size(int x){
		return sz[find(x)];
	}
};
////
void solve(){
	cin >> n >> m >> k;
	UnionFind uf(n+1);
	for(int i = 0; i < m; i++){
		int a,b;
		cin >> a >> b;
		a--; b--;
		uf.unite(a,b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	for(int i = 0; i < k; i++){
		int a,b;
		cin >> a >> b;
		a--; b--;
		if(uf.same(a,b)){
			vv[a].push_back(b);
			vv[b].push_back(a);
		}
	}
	
	for(int i = 0; i < n; i++){
		cout << uf.size(i) - 1 - v[i].size() - vv[i].size();
		if(i != n-1) cout << " ";
	}
	cout << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 13048
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

int n;
int rGraph[202020];
vector<int> Graph[202020];
int p[202020], a[202020];

bool search(int s, int sg){
    int pre = sg;
    int cur = rGraph[s];
    while(cur != s){
        set<int> st;
        st.insert(pre);
        for(auto to : Graph[cur])if(a[to] != -1)st.insert(a[to]);
        int g = 0;
        while(st.count(g))g++;
        pre = g;
        cur = rGraph[cur];
    }
    set<int> st;
    st.insert(pre);
    for(auto to : Graph[cur])if(a[to] != -1)st.insert(a[to]);
    int g = 0;
    while(st.count(g))g++;
    return sg == g;
}

int main(){
    REP(i, 202020)a[i] = -1;
    cin >> n;
    REP(i, n)cin >> p[i], p[i]--, Graph[p[i]].emplace_back(i), rGraph[i] = p[i];

    queue<int> q;
    REP(i, n)if((int)Graph[i].size() == 0)q.push(i);

    while(!q.empty()){
        int cur = q.front();
        q.pop();
        set<int> st;
        bool flg = false;
        for(auto to : Graph[cur]){
            if(a[to] == -1)flg = true;
            st.insert(a[to]);
        }
        if(flg)continue;
        int g = 0;
        while(st.count(g))g++;
        a[cur] = g;
        q.push(rGraph[cur]);
    }
    int s = 0;
    while(a[s] != -1)s++;
    set<int> st;
    for(auto to : Graph[s])if(a[to] != -1)st.insert(a[to]);
    int sg = 0;
    while(st.count(sg))sg++;
    if(search(s, sg)){
        cout << "POSSIBLE" << endl;
        return 0;
    }
    st.insert(sg);
    while(st.count(sg))sg++;
    if(search(s, sg)){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 12672
from itertools import product
#%%
def resolve():
    n,m=map(int,input().split())
    A=[input() for _ in range(n)]
    B=[input() for _ in range(m)]
    flag = any([r[j:j+m] for r in A[i:i+m]]==B for i,j in product(range(n-m+1),range(n-m+1)))
    print("Yes" if flag else "No")
resolve()

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
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 u, v, d, c;
  edge(int u, int v, int d, int c) : 
    u(u), v(v), d(d), c(c) {}
  bool operator < (const edge& e) const {
    if(d != e.d) return d > e.d;
    else return c > e.c;
  }
};
typedef vector<edge> edges;

int main(){
  int N, M;
  while(cin>>N>>M && N){
    vector<edges> g(N);
    REP(i, M){
      int u, v, d, c;
      cin>>u>>v>>d>>c;
      u--, v--;
      g[u].push_back(edge(u, v, d, c));
      g[v].push_back(edge(v, u, d, c));
    }
    priority_queue<edge> que;
    int ans = 0;
    vector<bool> used(N);
    used[0] = true;
    FORIT(it, g[0]) que.push(*it);
    int cnt = 1;
    while(!que.empty()){
      edge e = que.top(); que.pop();
      if(used[e.v]) continue;
      //printf("edge(%d, %d, %d, %d)\n", e.u, e.v, e.d, e.c);
      ans += e.c;
      used[e.v] = true;
      cnt++;
      if(cnt == N) break;
      FORIT(it, g[e.v])if(!used[it->v]) que.push(edge(it->u, it->v, it->d + e.d, it->c));
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 2824
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::{max, min};

#[fastout]
fn main() {
    input! {
    n: i64,
    l: i64
    }
    let ans = (l..l + n).sum::<i64>() - (l..l + n).fold(l, |acc, x| if acc.abs() < x.abs() {acc} else {x});
    println!("{}", ans);
}


Measured memory_bytes: 2164
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

readline = stdin.buffer.readline

INF = 10 ** 10

N = int(readline())

cnt = 0

def dfs(A):
    global cnt
    if int(''.join(A)) > N:
        return
    
    if len(set(A)) == 4:
        cnt += 1
    
    
    for i in ["3", "5", "7"]:
        A.append(i)
        dfs(A)
        A.pop()


dfs(["0"])

print(cnt)



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

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

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n, z, w; cin>>n>>z>>w;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    if(n == 1) cout << abs(w-a[0]) << endl;
    else cout << max(abs(w-a[n-1]), abs(a[n-2]-a[n-1])) << endl;
}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
a=-1
t=-1
for i in range(N):
    A=int(input())
    if t+1<A:
        a=-1
        break
    if t+1==A:
        a+=1
    else:
        a+=A
    t=A
print(a)

Measured memory_bytes: 3060
n=int(input())
from itertools import combinations_with_replacement,product
li = list(product(range(1,101),repeat=3))
ans = [0]*10001

for k in li:
    if k[0]**2 + k[1]**2 + k[2]**2 + k[0]*k[1] + k[0]*k[2]+k[1]*k[2] < 10001:
        ans[k[0]**2 + k[1]**2 + k[2]**2 + k[0]*k[1] + k[0]*k[2]+k[1]*k[2]] += 1

for i in range(1,n+1):
    print(ans[i])

Measured memory_bytes: 80412
// D - Checker

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int N, K;
int h[3000][2000];
int cum[3001][2001];

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

	for (int i=0; i<N; i++) {
		int x, y;
		char c;
		cin >> x >> y >> c;

		// W to B
		if (c == 'W') x += K;

		// 0 < x < K*2, 0 < y < K の範囲に変換
		x = x % (K*2);
		y = y % (K*2);
		if (y >= K) {
			x = (x+K) % (K*2);
			y = y % K;
		}

		h[x][y]++;
		h[x+K][y+K]++;
		if (x-K >= 0) h[x-K][y+K]++;
		if (x+K*2 < K*3) h[x+K*2][y]++;
	}

	/*
	// **** debug ****
	for (int y=0; y<K*2; y++) {
		for (int x=0; x<K*3; x++) {
			cout << h[x][y] << " ";
		}
		cout << endl;
	}
	*/

	for (int y=0; y<K*2; y++) {
		for (int x=0; x<K*3; x++) {
			cum[x+1][y+1] = cum[x][y+1] + cum[x+1][y] - cum[x][y] + h[x][y];
		}
	}

	int ans = 0;
	for (int y=0; y<K; y++) {
		for (int x=0; x<K*2; x++) {
			int ok = cum[x+K][y+K] - cum[x][y+K] - cum[x+K][y] + cum[x][y];
			ans = max(ans, ok);
		}
	}

	cout << ans << endl;

	return 0;
}


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

int n,m,k,a,likes[31],ret=0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	memset(likes, 0, 31);
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>k;
		for(int j=0;j<k;j++){
			cin>>a;
			likes[a]++;
		}
	}
	for(int i=1;i<=m;i++){
		if(likes[i]==n)
			ret++;
	}
	cout<<ret;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int a,b,c;
	cin >> a >> b >> c;
	int count = 0;
	for( int i=a ; i<=b ; i++ ) {
		if( c % i == 0 ) { count++; }
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll N, D, X; cin >> N >> D >> X;
	ll A[100] = {};
	ll B = 0;
	ll n = 0;
	rep(i, 0, N) {
		cin >> A[i];
		n = 0;
		while (n*A[i] + 1 <= D) {
			B++;
			n++;
		}
	}
	cout << B + X << endl;

	return 0;
}

Measured memory_bytes: 256
// template {{{

#include <bits/stdc++.h>

// #define int long long

#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP2(i, n) REP3(i, 0, n)
#define REP3(i, a, b) REP4(i, a, b, 1)
#define REP4(i, a, b, s) for (int i = (a); i < (int)(b); i += s)
#define RREP2(i, n) RREP(i, 0, n)
#define RREP3(i, a, b) for (int i = (b) - 1; i >= (int)(a); i--)

#define rep(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define rrep(...) GET_MACRO(__VA_ARGS__, RREP3, RREP2)(__VA_ARGS__)
#define eb emplace_back
#define ef emplace_front
#define pb pop_back
#define pf pop_front
#define all(c) std::begin(c), std::end(c)
#define mp std::make_pair
#define mt std::make_tuple
#define fi first
#define se second
#define popcnt __builtin_popcountll

using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = std::vector<int>;
using vvi = std::vector<vi>;

template<typename T>
using maxpq = std::priority_queue<T, std::vector<T>, std::less<T>>;

template<typename T>
using minpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

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

template<typename T>
inline T sq(T x){ return x * x; }

template<typename T, typename U>
inline bool chmax(T &x, U y){ if (x >= y) return false; x = y; return true; }

template<typename T, typename U>
inline bool chmin(T &x, U y){ if (x <= y) return false; x = y; return true; }

template<typename T>
inline void sort(T &c){ std::sort(std::begin(c), std::end(c)); }

template<typename T>
inline void reverse(T &c){ std::reverse(std::begin(c), std::end(c)); }

template<typename T>
inline void unique(T &c){ std::sort(std::begin(c), std::end(c)); c.erase(std::unique(all(c)), std::end(c)); }

using namespace std;

// }}}

using pr = pair<int, int>;

int n, m;
vector<pr> g[400];
int indeg[400];
int dp[400];

int main()
{
	cin >> n >> m;
	rep(i, m){
		int a, b, c;
		cin >> a >> b >> c;
		g[a].eb(b, c);
		indeg[b]++;
	}

	queue<int> q;
	q.push(0);
	while (q.size()){
		int v = q.front(); q.pop();
		for (pr e : g[v]){
			int to, cost;
			tie(to, cost) = e;
			chmax(dp[to], dp[v] + cost);
			if (--indeg[to] == 0){
				q.push(to);
			}
		}
	}

	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 3148
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a == b) {
            System.out.println("Draw");
        } else if (a == 1) {
            System.out.println("Alice");
        } else if (b == 1) {
            System.out.println("Bob");
        } else if (a > b) {
            System.out.println("Alice");
        } else {
            System.out.println("Bob");
        }
    }
}



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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  int l, r;
  cin >> l >> r;
  int ans = 2018;
  for (int i = l; i < min(l + 2018, r); i++)
  for (int j = i + 1; j <= min(l + 2018, r); j++) {
    ans = min(ans, (i * j) % 2019);
  }
  cout << ans << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<set>
#include<string>
#include<climits>
using namespace std;
#define endl "\n"
#define M 1000000007
#define enter ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define mk(name,n,ty) ty* name=new ty[n]; 
typedef long long int ll;
const int MAX_N=100;
int main(){
    int n,k; cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
    int sum=0;
    for(int i=0;i<k;i++){
    	sum+=arr[i];
    }
    cout<<sum<<endl;	
	return 0;
  }

Measured memory_bytes: 3600
s=list(input())
t=list(input())
n=len(s)
m=len(t)
ans=10000
for i in range(n-m+1):
    z=0
    for j in range(m):
        if t[j]!=s[i+j]:
            z+=1
    ans=min(ans,z)
print(ans)




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

main()
{
	long long a1=0,a2=0,a3=0,ans=1e9;
	long long a,b;
	scanf("%lld %lld",&a,&b);
	for(int i=1;i<a;i++)
	{
		a1=i*b;
		a2=((a-i)/2)*b;
		if((a-i)%2==1)a3=(((a-i)/2)+1)*b;
		else a3=((a-i)/2)*b;
		long long dif=max(abs(a1-a2),max(abs(a2-a3),abs(a1-a3)));
		ans=min(ans,dif);
		a2=(b/2)*(a-i);
		if(b%2==1)a3=((b/2)+1)*(a-i);
		else a3=(b/2)*(a-i);
		dif=max(abs(a1-a2),max(abs(a2-a3),abs(a1-a3)));
		ans=min(ans,dif);
	}
	for(int i=1;i<b;i++)
	{
		a1=i*a;
		a2=((b-i)/2)*a;
		if((b-i)%2==1)a3=((b-i)/2+1)*a;
		else a3=((b-i)/2)*a;
		long long dif=max(abs(a1-a2),max(abs(a2-a3),abs(a1-a3)));
		ans=min(ans,dif);
		a2=(a/2)*(b-i);
		if(a%2==1)a3=(a/2+1)*(b-i);
		else a3=(a/2)*(b-i);
		dif=max(abs(a1-a2),max(abs(a2-a3),abs(a1-a3)));
		ans=min(ans,dif);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 256
def solve(n, dst):
    xs = []
    ans_cost = 0

    for _ in range(n):
        c, q = map(int, input().split())
        xs.append((c, q))
    xs.sort()

    for cost, quant in xs:
        if quant >= dst:
            ans_cost += cost * dst
            return ans_cost
        else:
            dst -= quant
            ans_cost += cost * quant


if __name__ == '__main__':
    n, dst = map(int, input().split())
    print(solve(n, dst))


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

int main() { 
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    for (int i=0; i<N; i++) {
        if (i==K-1) {
            cout << tolower(S[i], locale());
        } else {
            cout << S[i];
        }
    }
    cout << endl;
    
    return 0;
}

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

int main() {
    int Q;
    cin >> Q;
    priority_queue<int> l;
    priority_queue<int, vector<int>, greater<int>> r;
    long long lsum = 0, rsum = 0;
    long long bsum = 0;

    for(int i=0; i<Q; ++i) {
        char c;
        cin >> c;
        if(c == '1') {
            int a, b;
            cin >> a >> b;
            bsum += b;
            if(l.size() == r.size()) {
                if(r.empty() || a <= r.top()) {
                    l.push(a);
                    lsum += a;
                } else {
                    r.push(a);
                    rsum += a;
                    l.push(r.top());
                    lsum += r.top();
                    rsum -= r.top();
                    r.pop();
                }
            } else {
                if(a >= l.top()) {
                    r.push(a);
                    rsum += a; 
                } else {
                    l.push(a);
                    lsum += a;
                    r.push(l.top());
                    rsum += l.top();
                    lsum -= l.top();
                    l.pop();
                }
            }
        } else {
            long long x = l.top();
            cout << x << ' ' << (x * ((long long)l.size() - (long long)r.size()) + rsum - lsum + bsum) << endl;
        }
    }
}

Measured memory_bytes: 3452
#include <iostream>
#include <unordered_map>

int main()
{
    int n;
    std::cin >> n;
    
    std::unordered_map<int, int> numArray;
    
    long long sum = 0;
    
    for(int i = 0; i < n; ++i)
    {
        int a;
        std::cin >> a;
        ++numArray[a];
        sum += a;
    }
    
    int q;
    std::cin >> q;
    
    for(int i = 0; i < q; ++i)
    {
        int b, c;
        std::cin >> b >> c;
        if(numArray.find(b) != numArray.end())
        {
            int const changeNum = numArray.at(b);
            numArray.at(b) = 0;
            numArray[c] += changeNum;
            sum += (c - b) * changeNum;
        }
        
        std::cout << sum << std::endl;
    }
}

Measured memory_bytes: 6184
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,D = MI()
    X = LLIN(N)
    ans = 0

    def distanse(A,B):
        sum = 0
        for a,b in zip(A,B):
            sum += (a-b) ** 2
        return sqrt(sum)

    for i in range(N):
        for j in range(i+1,N):
            if i == j:
                continue
            dist =  distanse(X[i], X[j])
            if dist == int(dist):
                ans+=1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=3005;
const int mod=1e9+7;
int n,q,dp[N],lim_r[N],sum0[N];

namespace utils{
	template <class T> inline void apx(T &x,const T y){
		x<y?x=y:0;
	}
	template <class T> inline void apn(T &x,const T y){
		x>y?x=y:0;
	}
	inline int nxi(FILE *fd=stdin){
		int x=0;
		char c;
		while(((c=fgetc(fd))>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=fgetc(fd));
		while(x=x*10-48+c,(c=fgetc(fd))>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	static char str[N];
	n=nxi(),q=nxi();
	scanf("%s",str+1);
	for(int i=1; i<=n; ++i){
		lim_r[i]=i;
		sum0[i]=sum0[i-1]+(str[i]=='0');
	}
	for(int i=1; i<=q; ++i){
		const int x=nxi(),y=nxi();
		for(int i=x; i<y; ++i){
			apx(lim_r[i],y);
		}
	}
	for(int i=1; i<=n; ++i){
		apx(lim_r[i],lim_r[i-1]);
	}
	dp[0]=1;
	for(int i=0; i<n; ++i){
		static int fp[N];
		memcpy(fp,dp,n*sizeof(int));
		memset(dp,0,n*sizeof(int));
		int r=lim_r[i+1];
		int add_0=sum0[r]-sum0[lim_r[i]];
		for(int j=0; j<=r; ++j){
			if(!fp[j]) continue;
			//print 1
			if(j+add_0<r-i){
				dp[j+add_0]=(dp[j+add_0]+fp[j])%mod;
			}
			//print 0
			if(j+add_0-1>=0){
				dp[j+add_0-1]=(dp[j+add_0-1]+fp[j])%mod;
			}
		}
	}
	printf("%d\n",dp[0]);
	return 0;
}


Measured memory_bytes: 256