akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

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

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;


template<lint mod>
struct Int_{
  unsigned x;
  unsigned mpow(Int_ a,unsigned k){
    Int_ res=1;
    while(k){
      if(k&1) res=res*a;
      a=a*a;
      k>>=1;
    }
    return res.x;
  }
  unsigned inverse(Int_ a){
    return mpow(a,mod-2);
  }
  Int_(): x(0) { }
  Int_(long long sig) {
    int sigt=sig%mod;
    if(sigt<0) sigt+=mod;
    x=sigt;
  }
  unsigned get() const { return (unsigned)x; }
  
  Int_ &operator+=(Int_ that) { if((x += that.x) >= mod) x -= mod; return *this; }
  Int_ &operator-=(Int_ that) { if((x += mod - that.x) >= mod) x -= mod; return *this; }
  Int_ &operator*=(Int_ that) { x = (unsigned long long)x * that.x % mod; return *this; }
  Int_ &operator=(Int_ that) { x=that.x; return *this;}
  Int_ &operator/=(Int_ that) { x=(unsigned long long) x * inverse(that.x)%mod; return *this;}
  bool operator==(Int_ that) const { return x==that.x; }
  bool operator!=(Int_ that) const { return x!=that.x; }

  Int_ operator-() const { return Int_(0)-Int_(*this);}
  Int_ operator+(Int_ that) const { return Int_(*this) += that; }
  Int_ operator-(Int_ that) const { return Int_(*this) -= that; }
  Int_ operator*(Int_ that) const { return Int_(*this) *= that; }
  Int_ operator/(Int_ that) const { return Int_(*this) /= that; }

};

namespace std{
  template<lint mod>
  ostream &operator <<(ostream& out,const Int_<mod>& a){
    out<<a.get();
    return out;
  }
  template<lint mod>
  istream &operator >>(istream& in,Int_<mod>& a){
    in>>a.x;
    return in;
  }
};

typedef Int_<1000000007> Int;
Int fact[200005];
int h,w,a,b;
Int rect(int w,int h){
  return fact[w+h]/fact[w]/fact[h];
}
int main(){
  fact[0]=1;
  REP(i,200004) fact[i+1]=fact[i]*(i+1);

  cin>>h>>w>>a>>b;

  Int res=0;
  REP(i,h-a){
    res+=rect(b-1,i)*rect(w-1-b,h-1-i);
  }
  cout<<res<<endl;





  return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define test() int t;cin>>t;loop(test,1,t+1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout<<"\n"
#define sp cout<<" "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define prsp(v) loop(i,0,v.size())cout<<v[i],sp;nl;
#define prpsp(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S<<" , ";nl;
#define prnl(v) loop(i,0,v.size())cout<<v[i],nl;nl;
#define prpnl(v) loop(i,0,v.size())cout<<v[i].F<<" "<<v[i].S,nl;nl;
#define MOD 1000000007
#define mod(n) (((n%MOD)+MOD)%MOD)
#define all(x) x.begin(),x.end()

const int N = 1e5+5;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};

int main() 
{
    fastio();

    ll n;
    cin>>n;

    ll ans = 0;

    for(ll i=1;i*i<=n;i++)
    {
        if( n%i == 0 )
        {
            if( n/i - i > 1 )
            {
                ans += (n/i-1);
            }
        }
    }
    cout<<ans,nl;

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
int vis[1100][1100],n;
inline void go(int le,int ri,int wh){
	if(le>=ri)return;
	int i,j,k,mid=(le+ri)>>1;
	for(i=le;i<=mid;i++)
	  for(j=mid+1;j<=ri;j++)
	    vis[i][j]=vis[j][i]=wh;
	go(le,mid,wh+1);
	go(mid+1,ri,wh+1);
}
int main(){
    int i,j,k;
    scanf("%d",&n);
    go(1,n,1);
    for(i=1;i<n;i++){
      for(j=1;j+i<n;j++)
        printf("%d ",vis[i][j+i]);
      printf("%d\n",vis[i][n]);
    }
	return 0;
}


Measured memory_bytes: 4608
a=[[10*[0]for _ in range(3)]for _ in range(4)]
for _ in range(int(input())):
 b,f,r,v=map(int,input().split())
 a[b-1][f-1][r-1]+=v
for i in range(4):
 [print('',*a[i][j])for j in range(3)]
 if i!=3:print('#'*20)

Measured memory_bytes: 5624
def Get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def Get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def Get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def Get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end

n=gets.to_i
s=Array.new(n)
n.times do|i|
  s[i]=gets.chomp
end
m=gets.to_i
t=Array.new(m)
m.times do|i|
  t[i]=gets.chomp
end

s.sort!

ans=0
n.times do|i|
  next if not i.zero? and s[i-1]==s[i]
  s_cnt=s.count(s[i])
  t_cnt=t.count(s[i])
  val=s_cnt>t_cnt ? s_cnt-t_cnt : 0
  ans=val if ans<val
end
puts ans

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

int main() {
	while (true) {
		double n;
		cin >> n;
		if (n == 0) break;
		vector<int> a(n);
		for (int i = 0; i < n; i++) cin >> a[i];

		double sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
		}

		double ave = sum / n;
		int cnt = 0;
		for (int i = 0; i < n; i++) {
			if (ave >= a[i]) {
				cnt++;
			}
		}
		cout << cnt << "\n";
	}
}


Measured memory_bytes: 3236
#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<set>
using namespace std;
#define pb push_back
#define POP pop_back()
#define ll long long
#define db double
#define POP pop_back()
#define endl '\n'
#define PII pair<int,int>
#define FI first
#define SE second
#define VI vector<int>
#define QI queue<int>
#define SI stack<int>
#define debug cout<<"debug"<<endl;
#define PLL pair<ll,ll>
#define PDD pair<double,double>
#define ULL unsigned long long
#define fo(i,a,b) for (int i=a;i<=b;++i)
#define fd(i,a,b) for (int i=a;i>=b;--i)
#define mem(x,a) memset(x,a,sizeof(x))
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int main(){
	ll x;cin >> x;
	for(ll i = 0;i <= 1000;i++){
		for(ll j = 0;j < i;j++){
			if(pow(i,5) - pow(j,5) == x){
				cout << i << " " << j << endl;
				return 0;
			}
			if(pow(i,5) + pow(j,5) == x){
				cout << i << " " << -j << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4096
/*
          ,     \    /      ,
         / \    )\__/(     / \
        /   \  (_\  /_)   /   \
   ____/_____\__\@  @/___/_____\____
  |             |\../|              |
  |              \VV/               |
  |        ------hoi-------         |
  |_________________________________|
   |    /\ /      \\       \ /\    |
   |  /   V        ))       V   \  |
   |/     `       //        '     \|
   `              V                '
*/

#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define f first
#define se second
#define Speedforce boost();
#define fop(s1, s2) freopen(s1, "r", stdin);freopen(s2, "w", stdout);

using namespace std;

void boost(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int N = 1e6;
const ll inf = 1e9 + 7;
const ld PI = acos(-1);

ll bin_pow(ll x, ll y){
    ll res = 1, base = x;
    while(y){
        if(y & 1){
            res *= base;
            res %= inf;
        }
        base *= base;
        base %= inf;
        y /= 2;
    }
    return res;
}

ll n, k;

int main(){
    Speedforce
    //fop("", "")
    cin >> n >> k;
    n -= n / k * k;
    cout << min(n, k - n);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


bool input() {
  return true;
}

void solve(){
}

int main() {
  int n; cin >>n;
  pair<int,int> res;
  res.first = 0; res.second = 0;
  rep(i, n){
    string s,t; cin >>s >>t;
    if (s > t) res.first += 3;
    else if (s < t) res.second += 3;
    else res.first++, res.second++;
  }
  cout <<res.first <<" " <<res.second <<endl;
}


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

int main() {
  vector<char> vec(3);
  int a = 0;
  for (int i = 0; i < 3; i++) {
    cin >> vec.at(i);
    if (vec.at(i) == 'o') {
      a++;
    }
    int sum = 700 + 100 * a;
    if (i == 2) {
      cout << sum << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 100000
#define FI freopen("input.txt","r",stdin)
#define FO freopen("output.txt","w",stdout)
#define sc(a) scanf("%d",&a);
#define sc2(a,b) scanf("d",&a,&b);
#define fast ios_base::sync_with_stdio(false);cin.tie();cout.tie();
vector<ll>graph[MAX];
bool visit[MAX];

int main()
{
    int x;
    bool flag=true;
    cin>>x;
    for(int i=0;i<x;i++)
    {
        int n;
        cin>>n;
        if(!(n&1))
        {
            if(n%3==0)
                continue;
            else if(n%5==0)
                continue;
            else
                flag=false;
        }
    }
    if(flag)
        cout<<"APPROVED\n";
    else
        cout<<"DENIED\n";
    return 0;
}




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

int main(){
  int H, W;
  cin >> H >> W;
  vector<string> a(H + 2);
  
  for(int i = 0;i < H + 2;i++){
    for (int j = 0;j < W + 2;j++){
      a.at(i) += '#';
    }
  }
  
  for(int i = 0;i < H;i++){
    string b;
    string s;
    cin >> b;
    s = a.at(i + 1);
    for(int j = 0;j < W;j++){
      s.at(j + 1) = b.at(j);
    }
    a.at(i + 1) = s;
  }
  for(int i = 0;i < a.size();i++){
    cout << a.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int i, j, k;
    int n, x;
    
    while(1) {
        scanf("%d %d\n", &n, &x);
        if (n == 0 && x == 0) break;
        
        int count=0;
        for(i=1; i<n-1; i++) {
            for(j=i+1; j<n; j++) {
                for(k=j+1; k<n+1; k++) {
                    if (i+j+k == x) count++;
                }
            }
        }
        
        printf("%d\n", count);
    }
    return 0;
}


Measured memory_bytes: 2140
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int ty;
    R(ty);
    if(ty==1)W("Hello World");
    else {
        int x,y;
        R(x,y);
        W(x+y);
    }
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "algorithm"
#include "vector"
#include "string"
#define cout(s) cout<<s<<endl 
using namespace std;

int main()
{
	string s[3];
	cin >> s[0] >> s[1] >> s[2];
	cout << char(s[0][0] + 'A' - 'a') << char(s[1][0] + 'A' - 'a') << char(s[2][0] + 'A' - 'a') << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back;0
ll power(ll a,ll x){if(x==0) return 1;ll y=power(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power(a,mod-2);}




 int main(){

 ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
 
 string s;
 cin>>s;
 int a =(s[0]-'0')*10+(s[1]-'0');
 int b=(s[2]-'0')*10+(s[3]-'0');
 //cout<<a<<" "<<b<<endl;
 string A="MMYY";
 string B="YYMM";
 
 if(a==0&&b==0){
   cout<<"NA"<<endl;
 }
 else
 if(a==0){
    if(b>12)
    cout<<"NA"<<endl;
    else
    cout<<B<<endl;
 }
 else
   if(b==0){
    if(a>12)
    cout<<"NA"<<endl;
    else
    cout<<A<<endl;

   }
 else
   if(a<=12&&b<=12){
       cout<<"AMBIGUOUS"<<endl;
   }
  else
   if(a>12&&b>12){
       cout<<"NA"<<endl;
   }
   else
     if(b>12){
        cout<<A<<endl;
     } 
   else{
        cout<<B<<endl;
   }

}


Measured memory_bytes: 256
A,B,C = map(int, input().split())

#for i in range(1, 101):
mods = list()
i = 1
while(True):
    #print("A * i = " + str(A * i) + ", mod = " + str((A * i) % B))
    mod = (A * i) % B
    if (mod == C):
        print("YES")
        break
    elif(mod in mods):
        print("NO")
        break
    else:
        mods.append(mod)
    i += 1

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

int main() {
  int n;
  cin >> n;
  map<int, int> a;
  for (int i = 0; i < n; i++) {
    int ii;
    cin >> ii;
    a[ii] = a[ii] + 1;
  }
  int res = 0;
  for (auto itr = a.begin(); itr != a.end(); ++itr) {
    res += (itr->second) - (itr->first) >= 0 ? (itr->second) - (itr->first)
                                             : itr->second;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4736
N = gets.to_i
L = gets.split.map(&:to_i)

a = (0...N).to_a.combination(3).select do |a,b,c|
  (L[a] + L[b] > L[c]) && (L[b] + L[c] > L[a]) && (L[c] + L[a] > L[b]) && L[a] != L[b] && L[b] != L[c] && L[c] != L[a]
end

puts a.size


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

const int MAXN = 1.1e5;
const int MAXM = 1.1e5;
int N, M;
int A[MAXM], B[MAXM];
vector<int> adj[MAXN];
int deg[MAXN];

int par[MAXM];
int getPar(int a) {
	return par[a] == 0 ? a : (par[a] = getPar(par[a]));
}
bool merge(int a, int b) {
	a = getPar(a), b = getPar(b);
	if (a == b) return false;
	par[b] = a;
	return true;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		int a, b; cin >> a >> b;
		A[i] = a, B[i] = b;

		adj[a].push_back(b);
		adj[b].push_back(a);
		deg[a]++;
		deg[b]++;
	}

	if (N == 1) {
		cout << "No" << '\n';
		exit(0);
	}

	for (int i = 1; i <= N; i++) {
		if (deg[i] % 2 == 1) {
			cout << "No" << '\n';
			exit(0);
		}
		assert(deg[i] >= 2);
	}
	for (int i = 1; i <= N; i++) {
		if (deg[i] >= 6) {
			cout << "Yes" << '\n';
			exit(0);
		}
		assert(deg[i] == 2 || deg[i] == 4);
	}

	vector<int> fours;
	int n4 = 0;
	for (int i = 1; i <= N; i++) {
		if (deg[i] == 4) {
			fours.push_back(i);
			n4++;
		} else {
			assert(deg[i] == 2);
		}
	}
	if (n4 >= 3) {
		cout << "Yes" << '\n';
		exit(0);
	}
	if (n4 <= 1) {
		cout << "No" << '\n';
		exit(0);
	}

	assert(n4 == 2);

	int s = fours[0], t = fours[1];
	int numE = 0;
	for (int nei : adj[s]) {
		int prv = s;
		int cur = nei;
		while (cur != s && cur != t) {
			assert(adj[cur].size() == 2);
			int nxt = adj[cur][0] ^ adj[cur][1] ^ prv;
			prv = cur;
			cur = nxt;
		}
		if (cur == t) {
			numE ++;
		}
	}
	if (numE == 4) {
		cout << "No\n";
	} else {
		cout << "Yes\n";
	}

	return 0;
}


Measured memory_bytes: 7168
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
p=p[-x:]
q.sort()
q=q[-y:]
p[len(p):len(p)]=q
p[len(p):len(p)]=r
p.sort()
p=p[-x-y:]
print(sum(p))

Measured memory_bytes: 23328
w,h,n = map(int,input().split())
xya = [list(map(int,input().split())) for _ in range(n)]
wzero,hzero = 0,0
for i in xya:
	if i[2] == 1:
		if wzero < i[0]:
			wzero = i[0]
	if i[2] == 2:
		if w  > i[0]:
			w = i[0]
	if i[2] == 3:
		if hzero < i[1]:
			hzero = i[1]
	if i[2] == 4:
		if h > i[1]:
			h = i[1]
print((h-hzero)*(w-wzero) if h-hzero >=0 and w-wzero>=0 else 0) 

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N, K;
    cin >> N >> K;
    vint a(N);
    vint dp(K + 1);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i <= K; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (dp[i] == 0 and i + a[j] <= K)
                dp[i + a[j]] = true;
        }
    }
    cout << (dp[K] ? "First" : "Second");
    return 0;
}

Measured memory_bytes: 640
n,m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
   a[i],b[i] = map(int, input().split())
if n < min(b) and n >= max(a):
    print(n - max(a) + 1)
elif min(b) >= max(a):
    print(min(b)-max(a) + 1)
else:
  print(0)

Measured memory_bytes: 10868
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int arr[n];
	
	for(int i=0;i<n;i++)cin >> arr[i];
	int dp[n];dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);

	for(int i=2;i<n;i++){
	dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
type bs_tree = Nil | Node of node and
     node = {
         key:int;
         mutable left:bs_tree;
         mutable right:bs_tree
       };;

let new_node key = {key=key;left=Nil;right=Nil};;

let insert t z =
  let rec loop y = function
      Nil -> y
    | Node x ->
       if z.key < x.key then
         loop (Node x) (x.left)
       else
         loop (Node x) (x.right)
  in
  let y = loop t t in
  match y with
    Nil -> (Node z)
  | Node y ->
     if z.key < y.key then
       y.left <- (Node z)
     else
       y.right <- (Node z)
    ;t
;;

let rec print_in = function
    Nil -> ()
  | Node x ->
     print_in (x.left);
     Printf.printf " %d" x.key;
     print_in (x.right)
;;

let rec print_pre = function
    Nil -> ()
  | Node x ->
     Printf.printf " %d" x.key;
     print_pre (x.left);print_pre (x.right)
;;

let () =
  let n = read_int () in
  let rec read t = function
      0 -> ()
    | i ->
       let com = Scanf.scanf "%s" (fun x -> x) in
       if com = "insert" then begin
           let arg = Scanf.scanf " %d\n" (fun x -> x) in
           let z = new_node arg in
           read (insert t z) (i-1)
         end
       else if com = "print" then begin
           let _ = Scanf.scanf "%s\n" (fun x -> x) in
           print_in t;print_newline ();
           print_pre t;print_newline ();
           read t (i-1)
         end
       else ()
  in read Nil n
;;

Measured memory_bytes: 28308
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int chk[10010010], n;
ll ans, cnt[10010010];

int f(int a, int b){
    int c = 0;
    while(b % a == 0) b /= a, c++;
    return c;
}

int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++) cnt[i] = 1;

    for(int i=2;i<=n;i++){
        if(chk[i]) continue;
        for(int j=i;j<=n;j+=i){
            chk[j] = 1;
            cnt[j] *= f(i, j) + 1;
        }
    }

    for(int i=1;i<=n;i++) ans += i * cnt[i];

    cout << ans;
}

Measured memory_bytes: 120800
def main():
    S = input()
    T = input()
    ans = len(T)
    for start in range(len(S) - len(T) + 1):
        cnt = 0
        for i in range(len(T)):
            if S[start + i] != T[i]:
                cnt += 1
        ans = min(ans, cnt)
    print(ans)


if __name__ == '__main__':
    main()

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

int main() {
  int A, B, n;
  cin >> A >> B;
  n = 0;
  for (int x = A; x <= B; x++) {
    int a, b, d, e;
    a = x / 10000;
    b = (x % 10000) / 1000;
    d = (x % 100) / 10;
    e = x % 10;
    if (a == e && b == d) {
      n++;
    }
  }
  cout << n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<deque>
#define ll long long
using namespace std;
#define BUF_SIZE 1048576
char _buf[BUF_SIZE],*_is=_buf,*_it=_buf;
inline char rdc(){
	if (_is==_it) _it=(_is=_buf)+fread(_buf,1,BUF_SIZE,stdin);
	return *_is++;
}
inline int rdi(){
	int x=0,f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	return f?-x:x;
}
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(int x){
	write(x);
	putchar(' ');
}
inline void print(int x){
	write(x);
	putchar('\n');
}
const int N=100001;
int n,m,ans,dp[N];
vector<int> adj[N];
inline int dfs(int v){
	if(~dp[v]) return dp[v];
	dp[v]=0;
	for(int u:adj[v]) dp[v]=max(dp[v],dfs(u));
	++dp[v];
	return dp[v];
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	memset(dp,-1,sizeof(dp));
	cin>>n>>m;
	int i,j,x,y;
	for(i=1;i<=m;++i) cin>>x>>y,adj[x].push_back(y);
	for(i=1;i<=n;++i) if(dp[i]==-1) ans=max(ans,dfs(i));
	cout<<ans-1<<endl;
	return 0;
}



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

const int mN = 100100;
int n,m;
vector<int> incoming[mN];

int dp[mN];
int reach(int u) {
    if (dp[u] > -1) return dp[u];
    int opt = 0;
    for (int w : incoming[u])
        opt = max(opt, reach(w));
    return dp[u] = ++opt;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
    cin >> n >> m;
    for (int i=1; i<=m; i++) {
        int x, y;
        cin >> x >> y;
        incoming[y].push_back(x);
    }
    fill(dp, dp+mN, -1);
    int ans = 0;
    for (int i=1; i<=n; i++)
        ans = max(ans, reach(i)-1);
    cout << ans;
	return 0;
}


Measured memory_bytes: 10624
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

int main() {
	int n, x, y;
	cin >> n >> x >> y;
	x--;
	y--;
	vector<int> ans(n, 0);
	for (int i = 0; i < n; i++) {
		queue<int> qu;
		vector<int> cost(n, -1);
		cost[i] = 0;
		qu.push(i);
		while (!qu.empty()) {
			int now = qu.front();
			qu.pop();
			if (now > 0 && cost[now - 1] < 0) {
				cost[now - 1] = cost[now] + 1;
				qu.push(now - 1);
			}
			if (now < n - 1 && cost[now + 1] < 0) {
				cost[now + 1] = cost[now] + 1;
				qu.push(now + 1);
			}
			if (now == x && cost[y] < 0) {
				cost[y] = cost[x] + 1;
				qu.push(y);
			}
			if (now == y && cost[x] < 0) {
				cost[x] = cost[y] + 1;
				qu.push(x);
			}
		}
		for (int i = 0; i < n; i++) {
			ans[cost[i]]++;
		}
	}
	for (int i = 1; i < n; i++) {
		cout << ans[i] / 2 << endl;
	}
}

Measured memory_bytes: 384
#include<stdio.h>

int main()
{
   char s1[20], s2[20];
   scanf("%s\n%s", s1, s2);

   for (int i = 0; s1[i]; ++i)
   {
      if(s1[i]!=s2[i]){
         printf("No\n");
         return 0;
      }
   }
   // int l1=0, l2=0;
   // while(s1[l1]) l1++;
   // while(s2[l2]) l2++;
   // if(l1+1==l2) 
   printf("Yes\n");
   //else printf("No\n");

   return 0;
}



Measured memory_bytes: 1620
n,m = map(int,input().split())
A = [int(input()) for _ in range(m)]

mod = 10**9+7

dp = [0]*(n+5)
dp[0] = 1
dp[1] = 1

for a in A:
    dp[a] = -1
for i in range(2,n+1):
    if dp[i] == 0:
        dp[i] = (max(0,dp[i-1])+max(0,dp[i-2]))%mod

print(max(dp[n],0))

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

using namespace std;

int main() {
	int n;
	cin >> n;
	if (n==1) {
		cout << "Hello World" << endl;
		return 0;
	}
	int a, b;
	cin >> a >> b;
	cout << a + b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int L=0,N,A,B,C,D;
	while(cin>>N){L=0;
	for(A=0;A<10;A++){
		for(B=0;B<10;B++){
			for(C=0;C<10;C++){
				for(D=0;D<10;D++){ 
					if(A+B+C+D==N){L++;};
				};};};};

	cout<<L<<endl;};
	cin>>L;
		return 0;

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9+5;
constexpr long long INFLL = 1LL<<60;
constexpr double eps = (1e-9);

class UnionFind {
public:
  // 親の番号を格納する。親だった場合は-(その集合のサイズ)
  vector<int> parent;

  // 作るときは parent の値を全て -1 にする
  // こうすると全てバラバラになる
  UnionFind(const int& n = 0) : parent(n, -1) {}

  // x がどのグループに属しているか調べる
  int find(const int& x) {
    if (parent[x] < 0) return x;
    return parent[x] = find(parent[x]);
  }

  // x と y をくっつける  O(log n)
  bool unite(int x, int y) {
    // x と y を直接くっつけるのではなく，root(x) に root(y) をくっつける
    x = find(x);
    y = find(y);
    if (x == y) return false;  // すでにくっついているからくっつけない

    // 大きい方(x) に小さい方(y)をくっつけたい 大小が逆だったらひっくり返す
    if (size(x) < size(y)) swap(x, y);

    parent[x] += parent[y];  // x のサイズを更新する
    parent[y] = x;  // y の親を x に変更する
    return true;
  }

  // 自分のいるグループの頂点数を調べる
  int size(const int& x) { return -parent[find(x)]; }

  // x と y が同じグループに属しているか否か
  bool same(const int& x, const int& y) { return find(x) == find(y); }
};

struct edge {
  int u, v, cost;
};

bool comp(const edge& e1, const edge& e2) {
  return e1.cost < e2.cost;
}

ll kruskal(const int& n, vector<edge>& es) {
  sort(es.begin(), es.end(), comp);
  UnionFind uf(n);
  ll res = 0;
  for (int i = 0; i < es.size(); i++) {
    edge e = es[i];
    if (!uf.same(e.u, e.v)) {
      uf.unite(e.u, e.v);
      res += e.cost;
    }
  }
  return res;
}

using P = pair<int, int>;

struct node {
  int x, y, id;
};

bool comp_by_x(const node& n1, const node& n2) {
  return n1.x < n2.x;
}

bool comp_by_y(const node& n1, const node& n2) {
  return n1.y < n2.y;
}

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

  int n;
  cin >> n;

  vector<node> nodes;

  rep(i, n) {
    int x, y;
    cin >> x >> y;
    nodes.push_back({x, y, i});
  }

  vector<edge> es;

  sort(ALL(nodes), comp_by_x);
  rep(i, n-1) {
    es.push_back({nodes[i].id, nodes[i+1].id, abs(nodes[i+1].x - nodes[i].x)});
  }

  sort(ALL(nodes), comp_by_y);
  rep(i, n-1) {
    es.push_back({nodes[i].id, nodes[i+1].id, abs(nodes[i+1].y - nodes[i].y)});
  }

  ll ans = kruskal(n, es);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7564
#include<bits/stdc++.h>
#include<stdint.h>
#define ii pair<int,int>
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int long long int
using namespace std;

int32_t main(){
	int n,x;
	cin>>n;
	int c=0;
	for(int i=0;i<n;i++){
		cin>>x;
		if(x<c){
			cout<<"No";return 0;
		}
		else if(x>c){
			c=max(c,x-1);
		}
	}
	cout<<"Yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  cin >> N;
  int rootN = sqrt(N);
  int num = rootN;
  while(num > 0){
    if(N % num == 0){
      break;
    } else {
      num--;
    }
  }
  long long int ans = num + N / num - 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <math.h>

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++)
static const ll maxLL = (ll)1 << 62;

///////////////////////////
////Prime Creator//////////
///////////////////////////
//bool Prime[100001] = {};
//void createPrime() {
//	ll n = 100001;
//	rep(i, 0, n) Prime[i] = true;
//	Prime[0] = false;
//	Prime[1] = false;
//	rep(i, 2, n) {
//		if (Prime[i]) {
//			rep(j, 2, n) {
//				if (j*i >= n)break;
//				Prime[j*i] = false;
//			}
//		}
//	}
//}
///////////////////////////
///////////////////////////

//Minimum Value
static const ll MIN_LL = (ll)1 << 55;

///////////////////////////
////Warshall Floyid
////All value should be initialized by MIN_LL
//static const ll wf_size = 300;
//ll wf[wf_size][wf_size];
//void WarshalFloyid() {
//	rep(k, 0, wf_size)rep(i, 0, wf_size)rep(j, 0, wf_size)wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j]);
//}
///////////////////////////

int main() {
	ll N; cin >> N;
	ll a[100];
	rep(i, 0, N)cin >> a[i];
	ll t = a[0];
	ll cnt = 0;
	ll color = 9999;
	rep(i, 1, N) {
		if (a[i - 1] == a[i]) {
			cnt++;
			a[i] = color--;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
from functools import reduce

def gcd(a,b):
  if b == 0:
    return a
  else:
    return gcd(b,a % b)
    
def lcm(a,b):
    return (a * b) // gcd(a, b)
    
def gcd_list(numbers):
    return reduce(gcd, numbers)

def lcm_list(numbers):
    return reduce(lcm, numbers, 1)
    
N = int(input())
A = list(map(int,input().split()))

div = 10 ** 9 + 7

LCM =  lcm_list(A)

total = 0

for i in range(N):
  total += LCM // A[i]
  
print(total % div)

Measured memory_bytes: 4708
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  string A[n];
  for(int i=0;i<n;i++) cin>>A[i];
  string C[n];
  for(int i=0;i<n;i++) C[i]=A[i];
  int ans=0;
    //C sorting by number
  for(int i=0;i<n;i++){
    for(int j=n-1;j>i;j--){
      if(C[j][1]<C[j-1][1]){
	swap(C[j],C[j-1]);
      }
    }
  }
    //+=的作用就是把重复数字前的字符+在一起，判断是否稳定（一样）
  string x[10],y[10];
  for(int i=0;i<n;i++){
    x[A[i][1]-'0']+=A[i][0];
    y[C[i][1]-'0']+=C[i][0];
  }
  ans=1;
  for(int i=0;i<10;i++) ans&=x[i]==y[i]; //ans = ans & (x[i] == y[i]),x[i] == y[i]时为1，否则为0，实则这个代码的意思就是相等时ans=1，否则为0
  for(int i=0;i<n;i++) cout<<C[i]<<" \n"[i==n-1];
  cout<<(ans?"Stable":"Not stable")<<endl;
  
  for(int i=0;i<n;i++) C[i]=A[i];
  for(int i=0;i<n;i++){
    int minj=i;
    for(int j=i;j<n;j++){
      if(C[j][1]<C[minj][1]){
	minj=j;
      }
    }
    if(i!=minj) swap(C[i],C[minj]);
  }
  
  for(int i=0;i<10;i++) x[i]=y[i]="";
  for(int i=0;i<n;i++){
    x[A[i][1]-'0']+=A[i][0];
    y[C[i][1]-'0']+=C[i][0];
  }
  ans=1;
  for(int i=0;i<10;i++) ans&=x[i]==y[i]; 
  for(int i=0;i<n;i++) cout<<C[i]<<" \n"[i==n-1];
  cout<<(ans?"Stable":"Not stable")<<endl;
  
  return 0;
}



Measured memory_bytes: 3224
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int flag = 0;
  char a;
  for (int i = 0; i < 3; i++)
  {
    scanf("%c", &a);
    if (a == '1')
      flag++;
  }

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

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

string s;

int main() {
	cin >> s;
	
	// 長さk(4以上)でアンバランスな部分があったとすると、それは必ずaaかabaって形を含む
	// 逆に言うと長さ2か3のアンバランスな部分がない場合、
	// 同じアルファベット2つの間に必ず2つ以上違うアルファベットが挟まっているのでアンバランスな部分は存在しない
	// だから長さ2と3でそういう形を探して1周ずつするだけでいい
	rep(i,s.length()-1) {
		if (s[i]==s[i+1]) {
			cout << i+1 << " " << i+2 << ln;
			return 0;
		}
	}
	rep(i,s.length()-2) {
		if (s[i]==s[i+2]) {
			cout << i+1 << " " << i+3 << ln;
			return 0;
		}
	}
	cout << "-1 -1" << ln;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  
  vector<int>x(n),y(n);
  for(int i=0; i<n; i++){
    cin >> x[i] >> y[i];
  }
  
  double ans=0;
  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      ans+=pow(pow(x[j]-x[i],2)+pow(y[j]-y[i],2),0.5);
    }
    
  }
  
  ans=ans*2/n;
  
  cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pii pair<int,int>
#define fi first 
#define se second 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);
#define mem(a,v) memset(a,v,sizeof(a))
const ll INF=1e18;
const int mod=1e9+7;
const int iinf=1e9+10;
const int xd[4]={1,0,-1,0},yd[4]={0,1,0,-1};
int main()
{
	faster
	int d,t,s;
	cin>>d>>t>>s;
	cout<<(t*s>=d?"Yes":"No");
}

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

using lint = long long;
const int MAXN = 6005;
const int INF = 1e5;

int N;
int A[MAXN];

int ans = 0;
int base = 0;
int nxt[MAXN];
int dp[MAXN][MAXN];

int Cost(int a, int b, int c) {
  return A[a] == A[b] && A[b] == A[c];
}

void Transition(int i, int j, int cur) {
  if (cur > 3 * N) return;
  if (cur == 3 * N) {
    ans = max(ans, dp[i][j] + Cost(i, j, cur));
    return;
  }
  dp[cur + 0][cur + 1] = max(dp[cur + 0][cur + 1], dp[i][j] + Cost(i, j, cur + 2));
  dp[cur + 0][cur + 2] = max(dp[cur + 0][cur + 2], dp[i][j] + Cost(i, j, cur + 1));
  dp[cur + 1][cur + 2] = max(dp[cur + 1][cur + 2], dp[i][j] + Cost(i, j, cur + 0));

  dp[i][cur + 0] = max(dp[i][cur + 0], dp[i][j] + Cost(j, cur + 1, cur + 2));
  dp[i][cur + 1] = max(dp[i][cur + 1], dp[i][j] + Cost(j, cur + 0, cur + 2));
  dp[i][cur + 2] = max(dp[i][cur + 2], dp[i][j] + Cost(j, cur + 0, cur + 1));

  dp[j][cur + 0] = max(dp[j][cur + 0], dp[i][j] + Cost(i, cur + 1, cur + 2));
  dp[j][cur + 1] = max(dp[j][cur + 1], dp[i][j] + Cost(i, cur + 0, cur + 2));
  dp[j][cur + 2] = max(dp[j][cur + 2], dp[i][j] + Cost(i, cur + 0, cur + 1));
  dp[i][j] = max( dp[i][j], dp[i][j] + Cost(cur+0, cur + 1, cur + 2));

}

int main() {

  cin >> N;
  for (int i = 1; i <= 3 * N; i++)
    cin >> A[i];


  while (true) {
    bool change = false;
    for (int i = 3; i + 2 <= 3 * N; i += 3) {
      if (A[i] == A[i + 1] && A[i + 1] == A[i + 2]) {
        base += 1;
        for (int j = i + 3; j <= 3 * N; j++) {
          A[j - 3] = A[j];
        }
        N -= 1;
        change = true;
        break;
      }
    }
    if (!change) {
      break;
    }
  }

  vector<int> last(3 * N + 1, 3 * N + 1);
  for (int i = 3 * N; i > 0; i--) {
    nxt[i] = last[A[i]];
    last[A[i]] = i;
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      dp[i][j] = -INF;
    }
  }
  dp[1][2] = 0;
  for (int i = 1; i <= 3 * N; i++) {
    for (int j = i + 1; j <= 3 * N; j++) {
      Transition(i, j, (j + 3) / 3 * 3);
            Transition(i, j, (j + 3) / 3 * 3);

      // Find next occurrence of A[i]
      if ( ((j + 3) / 3 * 3) <= (nxt[i] / 3 * 3) )
        Transition(i, j, nxt[i] / 3 * 3);

      // Find next occurrence of A[j]
      if ( ((j + 3) / 3 * 3) <= (nxt[j] / 3 * 3) )
        Transition(i, j, nxt[j] / 3 * 3);

    }
  }

  cout << ans + base << "\n";
  return 0;
}

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




int main() {

    int64_t x,y;
    cin>>x>>y;

    //x>=0,y>=0,  x=<y -> y-x
    //              x>y  -> x-y+2
    //x<0,y<0,    x=<y  -> abs(x)-abs(y)
    //            x>y    ->abs(y)-abs(x)+2
    // x>=0,y<0   abs(x)<=abs(y)  -> abs(y)-abs(x)+1
    //            abs(x)>abs(y)  ->  abs(x)-abs(y)+1
    // x<0,y>=0   abs(x)<=abs(y) -> abs(y)-abs(x)+1
    //            abs(x)>abs(y)  -> abs(x)-abs(y)+1


    if(x>0&&y==0){
      cout<<x+1<<endl;
    }
    else if(x<0&&y==0){
      cout<<abs(x)<<endl;
    }
    else if(x>=0&&y>=0){
      if(x<=y)
        cout<<y-x<<endl;
      else
        cout<<x-y+2<<endl;
    }else if(x<0&&y<0){
      if(x<=y)
        cout<<abs(x)-abs(y)<<endl;
      else
        cout<<abs(y)-abs(x)+2<<endl;
    }else{
      if(abs(x)<=abs(y))
        cout<<(abs(y)-abs(x)+1)<<endl;
      else
        cout<<(abs(x)-abs(y)+1)<<endl;
    }

	return 0;
}

Measured memory_bytes: 3508
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long dp[210000];
vector<int>at[210000];
int c[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",c+i);c[i]--;
	}
	for(int i=0;i<a;i++){
		at[c[i]].push_back(i);
	}
	dp[0]=1;
	for(int i=0;i<a;i++){
		int ind=lower_bound(at[c[i]].begin(),at[c[i]].end(),i)-at[c[i]].begin();
		int nx=-1;
		if(ind+1<at[c[i]].size()){
			nx=at[c[i]][ind+1];
		}
		if(nx!=-1&&nx!=i+1){
			dp[nx]=(dp[nx]+dp[i])%mod;
		}
		dp[i+1]=(dp[i+1]+dp[i])%mod;
	}
	printf("%lld\n",dp[a-1]);
}

Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
int main (){
  bool a=0;
  string s;
  cin>>s;
  if(s[5]=='1'){
  a=1;
  }
    else if(s[6]>'4')
      a=1;
  if(a==1)
    cout<<"TBD";
  else
    cout<<"Heisei";
  return 0;
}


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

//#define DEBUG
#define int long long
#define INF 1000000000
#define REP(i,n) for(int i=1;i<=n;i++)
typedef pair<int,int> P;
struct E {int to,cost;};
int n,m,c;
vector<E> G[100002];
int D[100002];
vector<P> V;

signed main(){
  cin>>n>>m>>c;
  int dsum=0;
  REP(i,m){
    int a,b,d;
    cin>>a>>b>>d;
    G[a].push_back({b,d});
    G[b].push_back({a,d});
    dsum+=d;
  }
  REP(i,n)D[i]=INF;
  queue<int> que;
  que.push(1);
  D[1]=0;
  while(!que.empty()){
    int h=que.front();que.pop();
    for(E e : G[h]){
      if(D[e.to]>D[h]+e.cost){
        D[e.to]=D[h]+e.cost;
        que.push(e.to);
      }
    }
  }
  REP(i,n){
    V.push_back(P(D[i],i));
  }
  sort(V.begin(),V.end());
  int x=0;
  int ans=dsum;
  int sub=0;
  REP(i,n-1){
    if(x!=V[i].first){
      ans=min(ans,c*x+dsum-sub/2);
      x=V[i].first;
    }
    for(E e : G[V[i].second]){
      if(D[e.to]<x){
        dsum-=e.cost;
      }else if(D[e.to]==x){
        sub+=e.cost;
      }
    }
    #ifdef DEBUG
    cout<<"x:"<<x<<" v1:"<<V[i].first;
    cout<<" dsum: "<<dsum<<endl;
    #endif
  }
  ans=min(ans,c*x);
  cout<<ans<<endl;
  #ifdef DEBUG
  REP(i,n)cout<<D[i]<<" ";
  cout<<endl;
  for(P p : V){
    cout<<p.first<<" "<<p.second<<endl;
  }
  #endif
  return 0;
}

Measured memory_bytes: 18712
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;

class Program
{
	static void Main(string[] args)
	{
		string s = "abcdefghijklmnopqrstuvwxyz";
		string C = Console.ReadLine();

		Console.WriteLine(s.Substring(s.IndexOf(C) + 1,1));
	}
}

//string s = Console.ReadLine();
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];
//int N = int.Parse(Console.ReadLine());

//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.ReadKey();


Measured memory_bytes: 13404
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
int main(void){
   ll n;
   ll x;
   ll t;
   cin>>n>>x>>t;
   if(n%x==0){
       cout<<n/x*t<<endl;
   }else{
       cout<<n/x*t+t<<endl;
   }
}


Measured memory_bytes: 3612
//ABC127のA問題を解いてみた

#include <iostream>

using namespace std;

int main(){
int A;
//高橋くんの年齢
int B;
//観覧車の料金
cin >> A >> B;
if (A >= 13){
cout << B << endl;
//年齢が13歳以上の場合の結果を出力する処理
} else if (A >= 6 && A <= 12){
cout << B / 2 << endl;
//年齢が6歳以上かつ12歳以下の場合の結果を出力する処理 
} else if (0 <= 5){
cout << 0 << endl;
//年齢が5歳以下の場合の結果を出力する処理
}
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
template <typename T> using posteriority_queue = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
template <typename T> void unique(vector<T> &a) { a.erase(unique(ALL(a)), a.end()); }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <typename Ring>
vector<Ring> fzt(const vector<Ring> &a, bool superset, const Ring UNITY = 0, function<Ring(Ring, Ring)> fn = [](Ring a, Ring b) { return a + b; }) {
  int n = a.size(), p = 1;
  while ((1 << p) < n) ++p;
  n = 1 << p;
  vector<Ring> res(a);
  res.resize(n, UNITY);
  for (int i = 1; i < n; i <<= 1) REP(j, n) {
    if ((j & i) == 0) {
      if (superset) {
        res[j] = fn(res[j], res[j | i]);
      } else {
        res[j | i] = fn(res[j | i], res[j]);
      }
    }
  }
  return res;
}

int main() {
  int n; cin >> n;
  using P = pair<int, int>;
  vector<P> a(1 << n, {0, 0}); REP(i, 1 << n) cin >> a[i].first;
  function<P(P, P)> fn = [](P a, P b) {
    vector<int> tmp{a.first, a.second, b.first, b.second};
    sort(ALL(tmp), greater<int>());
    return make_pair(tmp[0], tmp[1]);
  };
  vector<P> f = fzt(a, false, {0, 0}, fn);
  vector<int> ans(1 << n);
  REP(i, 1 << n) ans[i] = f[i].first + f[i].second;
  FOR(i, 1, 1 << n) {
    chmax(ans[i], ans[i - 1]);
    cout << ans[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 8192