akhauriyash/Code-Regression huggingface dataset:
import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

int N, W;
int[] ws;
int[] A;

void input() {
    scanf("%d %d\n", &N, &W);
    ws = new int[N];
    foreach (ref w; ws) {
        scanf("%d\n", &w);
    }
    ws.sort!"a > b";
    A = new int[N + 1];
    A[0] = 0;
    foreach (i; 1 .. N + 1) {
        A[i] = A[i - 1] + ws[i - 1];
    }
}

const MOD = cast(int)(1e9 + 7);
int[10002][202] dp;

void main() {
    input;
    if (A[N] < W) {
        writeln(1);
        return;
    }
    dp[0][0] = 1;
    foreach (i; 0 .. N) {
        foreach (j; 0 .. W + 1) {
            if (j + ws[i] <= W) {
                dp[i + 1][j + ws[i]] += dp[i][j];
                dp[i + 1][j + ws[i]] %= MOD;
            }
            if (j + (A[N] - A[i + 1]) > W - ws[i]) {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= MOD;
            }
        }
    }
    int ans = 0;
    foreach (i; 0 .. W + 1) {
        ans = (ans + dp[N][i]) % MOD;
    }
    writeln(ans);
}

Measured memory_bytes: 8976
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String stra;
		String strb;
		String strc;
		stra = sc.next().toUpperCase();
		strb = sc.next().toUpperCase();
		strc = sc.next().toUpperCase();
		System.out.print(stra.charAt(0));
		System.out.print(strb.charAt(0));
		System.out.print(strc.charAt(0));
	}

}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+5;
int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int a[N];
int32_t main()
{
    IOS;
    int n,k,l;
    cin>>n;
    
    map<int,int>mp;
    int mx=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        a[i]-=i;
    }
    sort(a+1,a+n+1);
    int mn=1e18;
    int med=n/2;
    for(int i=n/2-1;i<=n/2+1;i++)
    {
        if(i>=1&&i<=n)
        {
            int ans=0;
            for(int j=1;j<=n;j++)
            {
                ans+=abs(a[j]-a[i]);
            }
            mn=min(mn,ans);
        }
    }
    cout<<mn<<endl;




 
 
    
    
 
 
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
ll fx(long double kakudo, long double pi, int a, int b){
    ll S;
    if(kakudo > pi/2.0-0.0000000001){
        return 0.0;
    }
    if(a*tan(kakudo)>b){
        S = b*b/tanl(kakudo)*a/2.0;     
    }else{
        S = b*a*a-tan(kakudo)*a*a*a/2.0;
    }
    return S;
}
int main(){
    int a,b,x;
    cin>>a>>b>>x;
    long double pi = acos(-1);
    long double low = 0.0, high=pi/2.0;
    for(int i=0; i<100000; i++){
        long double mid = (high+low)/2.0;
        if(fx(mid,pi,a,b)<x) high = mid;
        else low = mid;
    }
    cout<<fixed << setprecision(12);
    cout<<high/pi*180<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		double d = sc.nextDouble();
		double x = Math.PI;
		out.println(d * 2 * x);
		
		out.close();
	}

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




Measured memory_bytes: 33380
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 100000
#define MO 1000000007
using namespace std;
char str[MAXN+5];
int cnt[100];
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",str+1);
	for(int i=1;i<=n;i++)
		cnt[str[i]-'a']++;
	int ans=1LL;
	for(int i=0;i<26;i++)
		ans=1LL*ans*(1LL*cnt[i]+1LL)%MO;
	ans=((1LL*ans-1LL)%MO+MO)%MO;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
class RollingHash():
    def __init__(self, s):
        self.length = len(s)
        self.base1 = 1009
        self.base2 = 1007
        self.mod1 = 10**9 + 7
        self.mod2 = 10**9 + 9
        self.hash1 = [0] * (self.length + 1)
        self.hash2 = [0] * (self.length + 1)
        self.pow1 = [1] * (self.length + 1)
        self.pow2 = [1] * (self.length + 1)

        for i in range(self.length):
            self.hash1[i+1] = (self.hash1[i] + ord(s[i])) * self.base1 % self.mod1
            self.hash2[i+1] = (self.hash2[i] + ord(s[i])) * self.base2 % self.mod2
            self.pow1[i+1] = self.pow1[i] * self.base1 % self.mod1
            self.pow2[i+1] = self.pow2[i] * self.base2 % self.mod2
        
    def get(self, l, r):
        t1 = self.hash1[r] - self.hash1[l] * self.pow1[r-l] % self.mod1
        t1 = (t1 + self.mod1) % self.mod1
        t2 = self.hash2[r] - self.hash2[l] * self.pow2[r-l] % self.mod2
        t2 = (t2 + self.mod2) % self.mod2
        return (t1, t2)

class FastRollingHash():
    def __init__(self, s):
        self.length = len(s)
        self.base = 1009
        self.mod = (1 << 61) - 1
        self.hash = [0] * (self.length + 1)
        self.pow = [1] * (self.length + 1)

        for i in range(self.length):
            self.hash[i+1] = (self.hash[i] + ord(s[i])) * self.base % self.mod
            self.pow[i+1] = self.pow[i] * self.base % self.mod

    def get(self, l, r):
        t = self.hash[r] - self.hash[l] * self.pow[r-l] % self.mod
        t = (t + self.mod) % self.mod
        return t

n = int(input())
s = input()
RH = RollingHash(s)

def check(l):
    place = {}
    for i in range(n - l + 1):
        hs = RH.get(i, i + l)
        if hs in place:
            if i - place[hs] >= l:
                return True
        else:
            place[hs] = i
    return False

l = 0; r = n // 2 + 1
while r - l > 1:
    m = (l + r) // 2
    if check(m):
        l = m
    else:
        r = m

print(l)

Measured memory_bytes: 44016
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstring>
#define ll long long 
#define rep(i,a) for(int i= 0;i < a;i++)
using namespace std;

int main() {
    #ifndef ONLINE_JUDGE
		freopen("input.txt", "r" , stdin);
		freopen("output.txt", "w" , stdout);
	#endif
	ios::sync_with_stdio(0); 
	cin.tie(0); cout.tie(0);
   ll a,b,c,k;
   cin>>a>>b>>c>>k;
   if(k<=a) cout<<k;
   else if(k>a && k<(a+b)) cout<<a;
   else cout<<(a+a-k+b);

   return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI pair<int,int>
const int maxm=2e5+5;
const int mod=1e9+7;
//n<=2e5
//a[i],b[i]<=2e3
int fac[maxm],inv[maxm];
int a[maxm],b[maxm];
int d[4444][4444];
int n;
int ppow(int a,int b,int mod){
    int ans=1%mod;a%=mod;
    while(b){
        if(b&1)ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}
void init(){
    fac[0]=1;
    for(int i=1;i<maxm;i++)fac[i]=fac[i-1]*i%mod;
    inv[maxm-1]=ppow(fac[maxm-1],mod-2,mod);
    for(int i=maxm-2;i>=0;i--)inv[i]=(i+1)*inv[i+1]%mod;
}
int C(int n,int m){
    if(m<0||m>n)return 0;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
signed main(){
    init();
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i]>>b[i];
    const int base=2000;
    for(int i=1;i<=n;i++){
        d[-a[i]+base][-b[i]+base]++;
    }
    for(int i=0;i<=4010;i++){
        for(int j=0;j<=4010;j++){
            if(i-1>=0)d[i][j]+=d[i-1][j];
            if(j-1>=0)d[i][j]+=d[i][j-1];
            d[i][j]%=mod;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans+=d[a[i]+base][b[i]+base];
        ans%=mod;
    }
    for(int i=1;i<=n;i++){
        ans-=C(2*(a[i]+b[i]),2*a[i]);
        ans%=mod;
    }
    ans=(ans*ppow(2,mod-2,mod)%mod+mod)%mod;
    cout<<ans<<endl;
    return 0;
}
/*
发现a[i]和b[i]很小,是可以O(n^2)的范围

C(x+y,x)可以看作是(0,0)到(x,y)的方案数,
如果我们要求(0,0)到(x,y)的方案数,
可以令d[i][j]表示(0,0)到(i,j)的方案数,一开始d[0][0]=1.
转移方程为d[i][j]=d[i-1][j]+d[i][j-1].

C(a[i]+a[j]+b[i]+b[j],a[i]+a[j])可以看作:
(0,0)到(a[i]+a[j],b[i]+b[j])的方案数.

枚举i和j是O(n^2)的,显然要优化,
尝试将i和j分开:
将坐标位移一下变为(-a[i],-b[i])到(a[j],b[j])的方案数.
这样i和j就分离了,然后就可以单独计算每个部分的贡献.

观察前面的dp方程,我们一开始令d[0][0]=1,
然后计算出的d[x][y]就是(0,0)到(x,y)的方案数,
那么我们令d[-a[i]][-b[i]]=1,
那么计算出的d[x][y]就是(-a[i],-b[i])到(x,y)的方案数.
这样的话,我们一开始只需要令所有的d[-a[i]][-b[i]]++,
那么计算出来的d[x][y]就是所有数对到达(x,y)的方案数.
因此最后只需要累加d[a[i]][b[i]]即可.
但是存在(-a[i],-b[i])到(a[i],b[i])的方案数,也就是自己和自己匹配,
而题目只需要计算i<j的,因此减掉自己和自己匹配的,方案数为C(2*(a[i]+b[i]),2*a[i]).
最后答案还要再除以2,因为是计算出的是无序的,题目要的是有序的.

参考:
https://www.luogu.com.cn/blog/Ebola-Emperor/solution-at1983
https://www.luogu.com.cn/blog/208529/solution-at1983
*/


Measured memory_bytes: 149112
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	string s, t; cin >> s >> t;
	string k = t.substr(0, (int)s.length());

	cout << ((s == k) ? "Yes" : "No");

	return 0;
}

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

int main()
{
    int d[100];
    int N;
    int stage =1;
    cin >> N ;
    for(int i= 0 ; i<N ; i++)
    {
        cin >> d[i];
    }
    sort(d,d + N);
    for(int i = 0 ; i < N-1 ; i++)
    {
        if(d[i]<d[i+1])
        stage++;
    }
    cout << stage << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int M[13]={0,31,60,91,121,152,182,213,244,274,305,335,366};
  string S[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int m,d;
  while(cin>>m>>d,m){
    int index=M[m-1]+d;
    cout<<S[index%7]<<endl;
  }
  return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for(int i = 0; i < N; ++i){
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  int ans = (1e9);
  for(int i = 0; i < N; ++i){
    if(i+K-1 >= N) break;
    ans = min(ans, H[i+K-1]-H[i]);
  }
  cout << ans << endl;
  return 0;
}


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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int n;

map <string, bool> mp;

void read() {
  cin >> n;
}

void solve() {
  char last;
  string s;
  cin >> s;
  mp[s] = 1;
  last = s[s.size() - 1];
  for(int i = 1; i < n; ++i) {
    string s;
    cin >> s;
    if (s[0] != last || mp[s]) {
      cout << "No";
      return;
    }
    mp[s] = 1;
    last = s[s.size() - 1];
  }
  cout << "Yes";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t; //please do not forget to comment this if there are no queries
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	long long int W,H,x,y,ans;
	cin>>W>>H>>x>>y;
	x=min(x,W-x);
	y=min(y,H-y);
	cout<<(double)W*H/2<<" ";
	if(x*2==W&&y*2==H)cout<<1;
	else cout<<0;
	return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl;
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// Aliases
#define PB push_back
#define MP make_pair
#define FST first
#define SND second
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

int main() {
    char a, b, c, d;
    cin >> a >> b >> c >> d;

    cout << ((a == b || b == c || c == d) ? "Bad" : "Good") << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
#define INF 100000000
#define MOD 100000007
int dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};
using namespace std;
 int N,A,B,C;
 vector<int>L;
int solve(int i,int a,int b,int c){
   if(i==N){
      if(!a or !b or !c){
         return INF;
      }
      return abs(a-A)+abs(b-B)+abs(c-C);
   }
   int res=solve(i+1,a,b,c);
   res=min(res,solve(i+1,a+L[i],b,c)+(a?10:0));
   res=min(res,solve(i+1,a,b+L[i],c)+(b?10:0));
   res=min(res,solve(i+1,a,b,c+L[i])+(c?10:0));
   return res;
}
int main(void){
   cin>>N>>A>>B>>C;
   L.resize(N);
   for(int i=0;i<N;i++){
      cin>>L[i];
   }
   cout<<solve(0,0,0,0)<<endl;
   return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	basicIO "io"
	"os"
	"strconv"
)

func main() {
	protagonist(os.Stdin, os.Stdout)
}

func protagonist(r basicIO.Reader, w basicIO.Writer) {
	io := NewIO(r, w)
	a, _ := io.nextInt()
	b, _ := io.nextInt()
	c, _ := io.nextInt()
	if a == b && b == c {
		io.PutString("Yes")
	} else {
		io.PutString("No")
	}
}

type IO struct {
	Scanner *bufio.Scanner
	Writer  basicIO.Writer
}

func NewIO(r basicIO.Reader, w basicIO.Writer) *IO {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &IO{
		Scanner: s,
		Writer:  w,
	}
}

func (io *IO) nextString() string {
	io.Scanner.Scan()
	return io.Scanner.Text()
}

func (io *IO) nextInt() (int, error) {
	io.Scanner.Scan()
	i, err := strconv.Atoi(io.Scanner.Text())
	return i, err
}

func (io *IO) PutInt(v int) {
	fmt.Fprintf(io.Writer, "%d\n", v)
}

func (io *IO) PutString(s string) {
	fmt.Fprintf(io.Writer, "%s\n", s)
}


Measured memory_bytes: 640
'use strict';

const input = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
const NM = input[0].split(' ').map(Number);
const N = NM[0];
const M = NM[1];

const As = input.slice(1, N + 1);
const Bs = input.slice(N + 1, N + M + 1);

for(let ax = 0; ax < N - M + 1; ax++) {
    for(let ay = 0; ay < N - M + 1; ay++) {
		let isMatch　= true
      	nextsearch:
        for(let bx = 0; bx < M; bx++){
            for(let by = 0; by < M; by++){
              	if(As[ax + bx][ay + by] != Bs[bx][by]){
                	isMatch = false;
                  	break nextsearch;
                }
            }
        }
        if(isMatch){
        	console.log("Yes")
          	return;
        }
    }
}
console.log('No');


Measured memory_bytes: 7372
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	string s; cin >> s;
	rep(i, 0, s.size()) {
		if (s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
		else if (s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	cout << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long int
using namespace std;










void solve() {
    LL a, b, n;
    cin >> a >> b >> n;
    if (n >= b - 1)
    {
        cout << floor((a * (b - 1)) / b) << "\n";
    }
    else
    {
        LL x = n;
        LL ans = floor((a * x) / b) - a * (floor(x / b));
        cout << ans << "\n";
    }








}




int main()
{


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


/*int n, q;
   cin >> n >> q;
   string s;
   cin >> s;
   transform(s.begin(), s.end(), s.begin(), ::tolower);
   int a[26] = {0};
   for (int i = 0; i < s.length(); i++)
   {
       a[s[i] - 'a']++;
   }
   int maxOcc = 0;
   for (int i = 0; i < 26; i++)
       maxOcc = max(maxOcc, a[i]);*/

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

int main(){
    string s,t; cin>>s>>t;
    bool ok=true;
    rep(i,0,s.size()){
        if(s[i]!=t[i]) ok=false;
    }
        
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;

int main() {

    int N;
    cin >> N;

    double jpySum = 0;
    double btcSum = 0;
    for (int i = 0; i < N; i++) {

        double x;
        string u;
        cin >> x >> u;

        if (u == "JPY") {
            jpySum += x;
        } else {
            btcSum += x;
        }

    }

    cout << jpySum + (btcSum * 380000.0) << "\n";

    return 0;
}

Measured memory_bytes: 256
use std::collections::*;

fn main() {
    let v = read_vec::<i64>();
    let (n, k) = (v[0] as usize, v[1]);
    let a = read_vec::<i64>().iter().map(|&x| x - 1).collect::<Vec<_>>();

    let mut s = vec![0; n + 1];
    for i in 0..n {
        s[i + 1] = (s[i] + a[i]) % k;
    }
    let mut count = HashMap::new();
    let mut ans = 0i64;
    let mut que = VecDeque::new();
    for i in 0..n + 1 {
        count.entry(s[i]).or_insert(0);
        ans += count[&s[i]];
        *count.entry(s[i]).or_insert(0) += 1;
        que.push_back(&s[i]);
        if que.len() as i64 >= k {
            let out = que.pop_front().unwrap();
            *count.get_mut(&out).unwrap() -= 1;
        }
    }
    println!("{}", ans);
}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 20048
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	ll n;
	vector<ll> v;
	ll ans = 0;

	cin >> n;

	REP(i, n) {
		ll a;
		cin >> a;
		v.push_back(a);
	}

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

	v.push_back(-1);

	ll count = 1;

	REP(i, n) {
		if (v[i] == v[i + 1]) {
			count++;
		}
		else {
			if (count % 2 == 1) {
				ans++;
			}
			count = 1;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1400
#include<stdio.h>
int main()
{
	int a,b,c,t;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
	if(a>c){
		t=a;
		a=c;
		c=a;
	}
	if(b>c){
		t=b;
		b=c;
		c=t;
	}
	printf("%d",c-a);
}

Measured memory_bytes: 128
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use proconio::{fastout, input, marker::Bytes, marker::Chars, marker::Isize1, marker::Usize1};
#[allow(unused_imports)]
use std::cmp;
use std::collections::BTreeMap;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let a = sc.read_vec::<usize>(n);
    let mut b = sc.read_vec::<usize>(n);

    b.reverse();
    let mut lft = 0;
    for i in 0..n {
        if a[i] != b[i] {
            continue;
        }

        while lft < n && (b[i] == b[lft] || a[lft] == b[i]) {
            lft += 1;
        }
        if lft >= n {
            println!("No");
            return;
        }
        b.swap(i, lft);
        lft += 1;
    }

    println!("Yes");
    for b in b.iter() {
        print!("{} ", *b);
    }
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 4924
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using static System.Math;
using Number = System.Int32;

namespace Program {
	public class Solver {
		Random rnd = new Random();
		public void Solve() {
			var s = rs;
			var t = rs;
			var a = ri;
			var b = ri;
			if (s == rs) a--;
			else b--;
			Console.WriteLine($"{a} {b}");
		}
		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		int ri { get { return sc.Integer(); } }
		long rl { get { return sc.Long(); } }
		double rd { get { return sc.Double(); } }
		string rs { get { return sc.Scan(); } }
		public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

		static T[] Enumerate<T>(int n, Func<int, T> f) {
			var a = new T[n];
			for (int i = 0; i < a.Length; ++i) a[i] = f(i);
			return a;
		}
		static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
	}
}

#region main
static class Ex {
	static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}
	static public void Main() {
		Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = true });
		var solver = new Program.Solver();
		//* 
		var t = new System.Threading.Thread(solver.Solve, 50000000);
		t.Start();
		t.Join();
		//*/
		// solver.Solve();
		Console.Out.Flush();
	}
}
#endregion
#region Ex
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

	public class Printer : StreamWriter {
		public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
		public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	}

	public class StreamScanner {
		public StreamScanner(Stream stream) { str = stream; }

		public readonly Stream str;
		private readonly byte[] buf = new byte[1024];
		private int len, ptr;
		public bool isEof = false;
		public bool IsEndOfStream { get { return isEof; } }

		private byte read() {
			if (isEof) return 0;
			if (ptr >= len) {
				ptr = 0;
				if ((len = str.Read(buf, 0, 1024)) <= 0) {
					isEof = true;
					return 0;
				}
			}
			return buf[ptr++];
		}

		public char Char() {
			byte b = 0;
			do b = read(); while ((b < 33 || 126 < b) && !isEof);
			return (char)b;
		}
		public string Scan() {
			var sb = new StringBuilder();
			for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
			return sb.ToString();
		}
		public string ScanLine() {
			var sb = new StringBuilder();
			for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}
}

#endregion


Measured memory_bytes: 14556
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int r[101];
struct Gr{
	int n;
	int tm;
	int pn;
	int vis;
};

int check(int a[17], int p)
{
	int t = 0;
	
	for(int i = 0; i < 17; i++){
		if(a[i] == 0){
			t++;
			if(t == p){
				return i-p+1;
			}
		} else {
			t = 0;
		}
	}
	
	return -1;
}

void func(void)
{
	int a[17], u, v;
	queue<Gr> que;
	Gr s;
	fill(a, a+17, 0);
	for(int i = 0; i < 100; i++){
		s.n = i;
		s.vis = i*5;
		s.pn = (i%5 == 1)? 5 : 2;
		s.tm = 17*(i%2) + 3*(i%3) + 19;
		que.push(s);
	}
	
	v = 0;
	while(!que.empty()){
		s = que.front();
		que.pop();
		for(;; v++){
			if(s.vis <= v){
				u = check(a, s.pn);
				if(u == -1){
					for(int i = 0; i < 17; i++){
						if(a[i] > 0){
							a[i]--;
						}
					}
					continue;
				}
				for(int i = 0; i < s.pn; i++){
					a[i+u] = s.tm;
				}
				r[s.n] = v-s.vis;
				break;
			} else {
				for(int i = 0; i < 17; i++){
					if(a[i] > 0){
						a[i]--;
					}
				}
			}
		}
	}
	
	return ;
}

int main()
{
	int n;
	fill(r, r+101, 0);
	func();
	
	while(cin>>n){
		cout << r[n] << endl;
	}
	
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	set<int> mochi;
	rep(i, n){
		int d;
		cin >> d;
		mochi.insert(d);
	}
	cout << mochi.size() << endl;
}

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

vector <ll> primes;
ll divi[1000005];
vector <ll> fact;

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

	ll i,j,k,l,m,n,t;

	cin >> n;

	if(n == 1)
	{
		cout << 0 << '\n';
		return 0;
	}

	for(i=2;i<1000005;i++)
	{
		for(j=i+i;j<1000005;j+=i)
		{
			divi[j] = -1;
		}

	}

	for(i=2;i<1000005;i++)
	{
		if(divi[i] != -1)
			primes.push_back(i);
	}

	for(i=0;i<primes.size();i++)
	{
		if(n%primes[i] == 0)
		{
			// cout << primes[i] << '\n';
			l = 0;
			while(n%primes[i] == 0)
			{
				n = n/primes[i];
				l++;
			}
			// cout << n << '\n';
			fact.push_back(l);
		}
	}

	if(n > 1)
		fact.push_back(1);

	ll ans = 0;

	for(i=0;i<fact.size();i++)
	{
		// cout << fact[i] << '\n';
		l = 0;
		k = 1;

		while(fact[i] >= l)
		{
			l += k;
			k++;

			if(fact[i] >= l)
				ans++;
			else
				break;
		}

	}


	cout << ans << '\n';
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define modsum(a, b) ((a) + (b) >= M ? (a) + (b) - M : (a) + (b))
#define modsubtract(a, b) ((a) - (b) < 0 ? (a) - (b) + M : (a) - (b))
#define modmultiply(a, b) (((a) * (b)) % M)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int &
#define SZ(a) ((int)((a).size()))
#define watch(x) cout << (#x) << " = " << (x) << endl;

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


inline void transpose(vector<string> &a) {

    int n = a.size();
    if (n == 0) return;
    int m = a[0].size();
    vector<string> b(m, string(n, ' '));
    fori (i, n) fori (j, m) b[j][i] = a[i][j];
    a = b;
}


template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "{";
    fori (i, SZ(a))
        out << a[i] << vector<string>{", ", "}"}[i + 1 == SZ(a)];
    return out;
}

void smain();

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


#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#define cerr cout
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\n";
    cout << "TOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}


const int N = 110;
const int L = 1e5 + 9;
const int oo = 1e9 + 1000;

int dp[N][L];
int w[N], v[N];
void smain() {
    fori (i, N) fori (j, L) dp[i][j] = oo;

    int n, W;
    cin >> n >> W;
    fori (i, n) cin >> w[i + 1] >> v[i + 1];

    fori (i, N) dp[i][0] = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = L - 1; j >= 0; --j) {
            dp[i][j] = dp[i - 1][j];
            if (j != L - 1) inmin(dp[i][j], dp[i][j + 1]);
            if (j - v[i] >= 0) inmin(dp[i][j], dp[i - 1][j - v[i]] + w[i]);
            if (i == n && dp[i][j] <= W) {
                cout << j;
                return;
            }
        }
    }
    assert(0);
}

Measured memory_bytes: 43264
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b == c) cout << a << endl;
	if ( a == c) cout << b << endl;
	if (b == a) cout << c << endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

#define debug(s) cout<< #s <<" = "<< s <<endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(a,val) memset(a, val, sizeof a)
#define PB push_back
#define endl '\n'

inline int myrand(int l, int r) {
	int ret = rand(); ret <<= 15; ret ^= rand();
	if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
	return ret;
}
template <typename F, typename S>
ostream& operator << (ostream& os, const pair< F, S>& p) {
    return os<<"(" <<p.first<<", "<<p.second<<")"; }

typedef pair<int, int> ii;
template<typename T> using min_pq =
	priority_queue<T, vector<T>, greater<T> >;

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

int n, m;
string s[100];

bool valid(int x, int y) {
	return 1 <= x and x <= n and 1 <= y and y <= m;
}

bool chex(int x, int y) {
	for(int i=0; i<4; i++) {
		int xx = x + dx[i];
		int yy = y + dy[i];
		if(valid(xx, yy)) {
			if(s[xx][yy] == '#')
				return true;
		}
	} return false;
}

bool solve() {
	for(int i=1; i<=n; i++) {
		for(int j=1; j<=m; j++) {
			if(s[i][j] == '.')
				continue;
			if(!chex(i, j)) {
				return false;
			}
		}
	} return true;
}

int32_t main () {
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	cin>>n>>m;
	for(int i=1; i<=n; i++) {
		cin>>s[i];
		s[i] = " " + s[i];
	}
	if(solve()) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int g[n + 1][n + 1];
    //?????????
    for (int i = 1; i <= n; i++) {
	for (int j = 1; j <= n; j++) {
	    g[i][j] = 0;
	}
    }
    //input
    for (int i = 1; i <= n; i++) {
	int a;
	cin >> a;
	int b;
	cin >> b;
	for (int j = 1; j <= b; j++) {
	    int c;
	    cin >> c;
	    g[a][c] = 1;
	}
    }
    for (int i = 1; i <= n; i++) {
	for (int j = 1; j <= n; j++) {
	    cout << g[i][j];
	    if (j != n) {
		cout << " ";
	    }
	}
	cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3096
mod=10**9+7
import math

def co(n,r,mod):
    x=1
    y=1
    for i in range(1,r+1):
        x=(x*(n-i+1))%mod
        y=(y*i)%mod
    return (x*pow(y,mod-2,mod))%mod
    
n,a,b=map(int,input().split())
ans=pow(2,n,mod)-1-co(n,a,mod)-co(n,b,mod)
print(ans%mod)#ansにmod取らないと無理


Measured memory_bytes: 38640
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;
#define int long long
const int N = (int) 1e5 + 5, mod = (int) 0;
int n, xa, xb, a[N];
bool check(int lim) {
	int cnt = 0;
	for (int j = 0; j < n; ++j) {
		int val = a[j] - ((long long) min((long double) lim * xb, (long double) 1e18));
		if (val > 0) {
			cnt += (val + xa - 1) / xa;
		}
	}
	return cnt <= lim;
}
int32_t main() {
	cin >> n >> xa >> xb;
	xa -= xb;
	for (int j = 0; j < n; ++j)
		cin >> a[j];
	int bl = -1, br = 1e18 + 1;
	while (bl < br - 1) {
		int bm = bl + br >> 1;
		if (check(bm)) {
			br = bm;
		} else {
			bl = bm;
		}
	}
	cout << br << endl;
}




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

int main(){

    long long n;
    cin >> n;
    long long a[n];
    long long sum=0;
    long long result=0;
    long long num=0;
    long long mod=1000000007;
    for(int i=0; i<n; i++){
        cin >> a[i];
        sum+=a[i];
    }
    for(int i=0;i<n;i++){
        sum-=a[i];
        num=((a[i]%mod)*(sum%mod))%mod;
        result = (result%mod + num%mod)%mod;
    }
    cout << (result) << endl;

    return 0;
}

Measured memory_bytes: 5208
import math

n = int(input())
d = dict()

for _ in range(n):
    s = "".join(sorted([x for x in input()]))
    d[s] = d.get(s, 0) + 1

ans = 0

for v in d.values():
    if v >= 2:
        ans += (v * (v-1)) // 2

print(ans)

Measured memory_bytes: 17848
#!/usr/bin/env python3

h, w = list(map(int, input().split()))
s = [list(str(input())) for i in range(h)]

for i in range(h):
    for j in range(w):
        tmp = 1
        if s[i][j] == "#":
            tmp = 0
            if i > 0:
                if s[i-1][j] == "#":
                    tmp += 1
            if i < h-1:
                if s[i+1][j] == "#":
                    tmp += 1
            if j > 0:
                if s[i][j-1] == "#":
                    tmp += 1
            if j < w-1:
                if s[i][j+1] == "#":
                    tmp += 1
        if tmp == 0:
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
string a;
int ans,l,maxx=-1*0x7fffffff;
int main(){
    cin>>l>>a;
    for(int i=0;i<l;i++){
        ans+=(a[i]=='I')?1:-1;
        maxx=max(ans,maxx);
    }
    if(maxx==-1)maxx=0;
    cout<<maxx<<endl;
    return 0;
}

Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()

str_l = 'abcdefghij'

ans = [0]
ans_str = []

def alter(array):
    s = ""
    for i in array:
        s += str_l[i]
    return s
def dfs(array):
    if len(array) == N:
        ans_str.append(alter(array))
        return
    for i in range(max(array) + 2):
        new_array = copy.deepcopy(array)
        new_array.append(i)
        dfs(new_array)

dfs(ans)
ans_str.sort()

for i in ans_str:
    print(i)

Measured memory_bytes: 106904
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <limits.h>
using namespace std;
int N;
string s;
int r,w;
int ans=10000000;
int tmp=0;
int main(){
	cin >> N;
	cin >> s;
	for(int i=0;i<s.length();i++){
		if(s[i]=='R')r++;
		else w++;
	}
	int nr=0,nw=0;
	int cr=0,cw=0;
	ans = min(ans,r);
	ans = min(ans,w);
	for(int i=0;i<s.length();i++){
		if(s[i]=='R')nr++;
		else nw++;

		cw=nw;
		cr=r-nr;
		//ans = min(ans,max(cr,cw));
		ans = min(ans,max(r-nr,nw));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int x, y, z, k;
	cin >> x >> y >> z >> k;

	vector<long long> a(x), b(y), c(z);

	for (int i = 0; i < x; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < y; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < z; i++) {
		cin >> c[i];
	}

	vector<long long> sum_ab, sum_abc;
	for (auto aaa: a) {
		for (auto bbb: b) {
			sum_ab.emplace_back(aaa + bbb);
		}
	}

	sort(sum_ab.begin(), sum_ab.end(), greater<long long>());
	if (sum_ab.size() > k) {
		sum_ab.resize(k);
	}

	for (auto ab: sum_ab) {
		for (auto ccc: c) {
			sum_abc.emplace_back(ab + ccc);
		}
	}
	sort(sum_abc.begin(), sum_abc.end(), greater<long long>());
	if (sum_abc.size() > k) {
		sum_abc.resize(k);
	}

	for (auto abc: sum_abc) {
		cout << abc << endl;
	}

	return 0;
}


Measured memory_bytes: 43240
n, m = map(int, input().split())
p = list(map(int, input().split()))

parent = [i + 1 for i in range(n)]
rank = [0 for i in range(n)]

def find(x):
    if parent[x - 1] == x:
        return x
    else:
        parent[x - 1] = find(parent[x - 1])
        return parent[x - 1]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x - 1] < rank[y - 1]:
        parent[x - 1] = y
    else:
        parent[y - 1] = x
        if rank[x - 1] == rank[y - 1]:
            rank[x - 1] += 1

for i in range(m):
    x, y = map(int, input().split())
    unite(x, y)
dic = {}
for i in range(n):
    dic.setdefault(find(i + 1), [set(), set()])
    dic[find(i + 1)][0].add(i + 1)
    dic[find(i + 1)][1].add(p[i])
ans = 0
for i in dic.values():
    ans += len(i[0] & i[1])
print(ans)

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define forn(i , n) for(int i=0;i<n;i++)


int gcd(int a , int b){
    if(a == 0) return b;
    else return gcd(b % a , a);
}


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

Measured memory_bytes: 3052
n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
a,x,y=1,1,t[0]
for i in t[1:]:
    if x==c or i>y+k:
        a+=1
        x=0
        y=i
    x+=1
print(a)

Measured memory_bytes: 8280
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


N = d_in()
A, B = ds_in()
p_list = np.array(ds_in())

first = (p_list <= A).sum()
second = np.logical_and(p_list > A, p_list <= B).sum()
third = (p_list > B).sum()
print(min(first, second, third))


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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

#define fi first
#define se second
#define all(A) A.begin(),A.end()

using namespace std;

/////////////////////////////////////////////////////

ll Sn,Tn;
char S[1010],T[1010];

ll i, j, k;

int main(){
    scanf("%s%s", S,T);
    Sn = strlen(S);
    Tn = strlen(T);
    ll ans = 1e9;
    rep(i,Tn,Sn+1){
        ll a = 0;
        rep(j,0,Tn){
            if(S[i-Tn+j]!=T[j])
                ++a;
        }
        ans = min(ans, a);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 3800