akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

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

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

int main() {
	
	int N, ans;
	double T, A, H, tem, d[10000];

	d[0] = 10000;

	cin >> N;
	cin >> T >> A;

	for (int i = 1; i <= N; i++) {
		cin >> H;
		tem = T - H * 0.006;
		d[i] = fabs(A - tem);
		if (d[i - 1] < d[i]) {
			d[i] = d[i - 1];
		}
		else {
			ans = i;
		}
		
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;
typedef unsigned long long ull;

int main()
{

	int n;
	ull ans=1;

	cin >> n;
	for(int i=1; i<=n; i++){
		ans = ans*(ull)i; 
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1156
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int h = sc1.nextInt();
		int w = sc1.nextInt();
		int ans = 0;

		ans = (n-h+1) * (n-w+1);

		System.out.println(ans);

		sc1.close();

	}

}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
typedef long double ld;
typedef long long ll;

const int M = 107;
const int ROOT = 13;

int n;
vector<int> g[M];
bool u[M];
int d[M], d2[M], d1[M];

void read() {
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
}

void dfs(int v, int x, int *d) {
  u[v] = true;
  d[v] = x;
  
  for (int to : g[v])
    if (!u[to]) {
      dfs(to, x + 1, d);
    }
}

ll check(vector<int> x) {
  //assert(x.size() == 2);
  //cerr << x[0] + 1 << " " << x[1] + 1 << endl;

  fill(u, u + n, false);

  for (int v : x) {
    u[v] = true;
  }

  for (int v : x) {
    dfs(v, 0, d);
  }

  ll prod = 1;

  vector<ll> mx(M, 1);
  for (int v = 0; v < n; ++v) {
    ll cnt = 0;
    for (int to : g[v])
      if (d[to] == d[v] + 1)
        ++cnt;
    mx[d[v]] = max(mx[d[v]], cnt);
  }

  for (ll x : mx)
    prod *= x;

  if (x.size() == 2)
    prod *= 2;

  return prod;
}

void kill() {
  int s1 = ROOT % n;
  dfs(s1, 0, d);


  s1 = max_element(d, d + n) - d;

  fill(u, u + n, false);
  dfs(s1, 0, d1);


  int s2 = max_element(d1, d1 + n) - d1;

  fill(u, u + n, false);
  dfs(s2, 0, d2);

  int D = *max_element(d1, d1 + n);


  ll prod = 2e18;

  if (D % 2 == 0) {
    vector<int> x;
    for (int i = 0; i < n; ++i)
      if (d1[i] == D / 2 && d2[i] == D / 2) {
        x.push_back(i);
      }

    assert(x.size() == 1);
    prod = check(x);

    for (int to : g[x[0]]) {
      prod = min(prod, check({x[0], to}));
    }
  } else {
    vector<int> x;
    for (int i = 0; i < n; ++i)
      if (d1[i] + d2[i] == D && min(d1[i], d2[i]) >= D / 2)
        x.push_back(i);
    prod = check(x);
  }

  cout << (D + 2) / 2 << " " << prod << "\n";
}

int main() {
#ifdef LOCAL
  assert(freopen("d.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  read();
  kill();
}



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

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    if(A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0])
        cout << "YES" << endl;
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*
	##############################
	## Author: Pratyush Gaurav ###
	## College: NIT ROURKELA #####
	##############################
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long/*--------------------*/lli;
typedef long double/*------------------*/ld;
typedef pair<lli, lli >/*--------------*/plli;
typedef vector<lli>/*------------------*/vlli;
typedef vector<plli >/*----------------*/vplli;

#define rep(i,a)/*---------------------*/for(i = 0 ; i < a ; i++)
#define repr(i,a)/*--------------------*/for(i = a ; i >= 0 ; i--)
#define REP(i,a,b)/*-------------------*/for(i = a ; i <= b ; i++)
#define REPR(i,a,b)/*------------------*/for(i = a ; i >= b ; i--)

#define scan(N)/*----------------------*/scanf("%lld",&N)
#define print(N)/*---------------------*/printf("%lld",N)
#define scan2(N1,N2)/*-----------------*/scanf("%lld %lld",&N1,&N2)
#define print2(N1,N2)/*----------------*/printf("%lld %lld",N1,N2)
#define scan3(N1,N2,N3)/*--------------*/scanf("%lld %lld %lld",&N1,&N2,&N3)
#define print3(N1,N2,N3)/*-------------*/printf("%lld %lld %lld",N1,N2,N3)

#define mem(a,b)/*---------------------*/memset(a,b,sizeof(a))
#define opt/*--------------------------*/ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a, b)/*--------------------*/__gcd(a, b)
#define lcm(a, b)/*--------------------*/((a)*((b)/gcd(a,b)))
#define sqr(x)/*-----------------------*/(x)*(x)
#define all(a)/*-----------------------*/a.begin(),a.end()
#define makepair/*---------------------*/make_pair
#define pushback/*---------------------*/push_back

#define endl/*-------------------------*/'\n'
#define inf/*--------------------------*/(lli)2000000000000
#define MOD/*--------------------------*/(lli)1000000007
#define MAXN/*-------------------------*/100005

template<class T> bool is_prime(T n)
{
	if((n%2 == 0 and n > 2) or n < 2 )
		return false;
	for(T i = 3; i*i <= n ; i += 2)
	{
		if( n % i == 0)
			return false;
	}
	return true;
}
lli power(lli a,lli b)
{
    lli value;
    if(!b)
    	return 1;
    else if(b%2==0)
    {
        value = power(a,b/2)%MOD;
        return (value * value)%MOD;
    }
    else
    {
        value = power(a,b/2)%MOD;
        return ((a*value)%MOD*(value))%MOD;
    }
}
bool compare(plli p1,plli p2)
{
    return p1.second > p2.second;
}
int main()
{
	opt;
	lli i,n,h,maxi = -inf,idx = -1,ans = 0;
	cin >> n >> h;
	lli mark[n];
	rep(i,n)
        mark[i] = 0;
	bool chk = false;
	vplli v(n);
	rep(i,n)
    {
        cin >> v[i].first >> v[i].second;
        if(maxi < v[i].first)
        {
            maxi = v[i].first;
            idx = i;
        }
    }
	sort(all(v),compare);
    rep(i,n)
    {
        if(v[i].second > maxi)
        {
            h -= v[i].second;
            mark[i] = 1;
            ans++;
        }
        if(h <= 0)
        {
            chk = true;
            break;
        }
    }
    if(chk)
    {
        cout << ans << endl;
        return 0;
    }
    ans += h/maxi;
    cout << ans + (h % maxi ? 1 : 0);
	return 0;
}










Measured memory_bytes: 2560
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define mp make_pair
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<30)
#define LLINF (1<<60)
#define MOD 1000000007
#define rep(i, n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;

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

    string s;
    cin >> s;
    int num;
    for (int i = s.length()-2; i >= 1; i--) {
        if (i % 2 == 0)continue;
        if (s.substr(0, i / 2 + 1) == s.substr(i / 2 + 1, i / 2 + 1)) {
            num = i+1;
            break;
        }
    }
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;
#define PI = 3.14159265358979323846
/*------------------------------------------------------------------------------*/

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

  REP(i, 0, s.size()-8){
    cout << s[i];
  }
  cout << endl;

  return 0;
}


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

class Main {
    static Scanner scanner = new Scanner();
    static long mod = 1000000007;

    public static void main(String[]$) {
        String s = scanner.next();
        if (s.equals("Sunny")) {
            System.out.println("Cloudy");
        } else if (s.equals("Cloudy")) {
            System.out.println("Rainy");
        } else if (s.equals("Rainy")) {
            System.out.println("Sunny");
        }
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 20820
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <vector>
typedef long long ll;
const int maxn = 1e5 + 5;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
ll a[maxn];

int main (int argc, char **argv) {
  int n;
  std::cin >> n;
  int cnt = 0;
  for (int i=1; i <= n; i++) {
    std::cin >> a[i];
    if (a[i] < 0) {
      cnt++;
    }
  }
  
  ll ans = 0;
  if (cnt&1) {
    ll min_val = a[1] > 0 ? a[1]:-a[1];
    for (int i=2; i <= n; i++) {
      min_val = std::min(min_val, a[i] > 0 ? a[i]:-a[i]);
    }
    ans -= 2*min_val;
  } 
  
  for (int i=1; i <= n; i++) {
    if (a[i] < 0) {
      ans -= a[i];  
    } else {
      ans += a[i];
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3932
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  ll tmp1 = N / (A + B);
  ll tmp2 = N % (A + B);
  if (tmp2 <= A) {
    cout << tmp1 * A + tmp2 << endl;
  } else {
    cout << tmp1 * A + A << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
ans = Array.new(n) { Array.new(n, 0) }
n.times do
  u, k, *v = gets.split.map(&:to_i)
  u -= 1
  v.each do |vi|
    vi -= 1
    ans[u][vi] = 1
    # ans[vi][u] = 1
  end
end

puts ans.map { |vs| vs * " " }



Measured memory_bytes: 6984
def LI():
	return [int(s) for s in input().split()]
  
N = int(input())
A_s = LI()

success_flag = True

for i in range(N-2,-1,-1):
  if A_s[i+1] < (A_s[i]-1):
    success_flag = False
    break
  elif  A_s[i+1] < A_s[i]:
    A_s[i]=A_s[i]-1

print('Yes') if success_flag else print('No')

Measured memory_bytes: 14396
// Problem : B - FizzBuzz Sum
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
		int n;
		cin>>n;
		int ans = 0;
		for(int i=1;i<=n;++i)
		{
			if(i%3==0&&i%5==0)
			continue;
			else if(i%3==0)
			continue;
			else if(i%5==0)
			continue;
			else
			ans+=i;
		}
		cout<<ans<<"\n";    	
    }
    return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
using namespace std;


int D[10];
int main() {
	int N, K;
	cin >> N >> K;
	
	int a;

	for (int i = 0; i < K; i++) {
		cin >> a;
		D[a]++;
		
	}
	for (int i = N; i > 0; i++) {
		int R = i;
		while (R) {
			if (D[R % 10] == 0) {
				R=(R-R%10) / 10;
			}
			else goto go;
		}
		cout << i << endl;
		goto gg;
	go:;
	}
gg:;

	return 0;
}


Measured memory_bytes: 256
def main():
     N = int(input())
     a1 = list(map(int,input().split(" ")))
     a2 = list(map(int,input().split(" ")))
     temp = 0
     for i in range(N):
         s = sum(a1[0:i+1])+sum(a2[i:])
         if temp<s:
             temp = s
     print(temp)

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
vector<int>kaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    //if(!kaijo[0])init_fact(2000010);
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,k;
int cnt[110];
signed main(){
    cin>>n>>k;
    rep(i,k){
        int d;
        cin>>d;
        rep(j,d){
            int a;
            cin>>a;
            cnt[a]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++)if(cnt[i]==0)ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	int A[100000];
	rep(i, N) cin >> A[i];

	int k = 0;
	vector<pair<int, int>> V;
	V.pb(mp(0, 0));
	rep(i, N) {
		if (A[i] > k) {
			V.pb(mp(A[i], i));
			k = A[i];
		}
	}
	ll B[100001] = {};
	int C[100001] = {};
	rep(i, N) {
		int k2 = lower_bound(V.begin(), V.end(), mp(A[i], 0)) - V.begin();
		B[k2] += A[i] - V[k2 - 1].first;
		C[k2]++;
		ce(B[k2 + 1]);
	}

	int mae = 1e9;
	k = (int)V.size();
	ll l = 0;
	for (auto itr = V.rbegin(); itr != V.rend(); itr++) {
		B[k] += l * (mae - (*itr).first);
		mae = (*itr).first;
		l += C[k];
		k--;
	}

	ll kotae[100000] = {};
	rep(i, V.size()) {
		kotae[V[i].second] = B[i];
	}
	rep(i, N) co(kotae[i]);

	Would you please return 0;
}

Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  rep(i, 1000) {
    vi a(3);
    a[0] = i / 100;
    a[1] = i / 10 - a[0] * 10;
    a[2] = i % 10;
    int k = 0;
    rep(j, n) {
      if(s[j] - '0' == a[k]) k++;
      if(k == 3) {
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(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};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

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



int n, k, a[101], b[101];

void fin() {
	cout << "Impossible" << endl;
	exit(0);
}

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a[i];
		b[a[i]]++;
	}
	k = *max_element(a,a+n);
	rep(i,n) if (a[i]<(k+1)/2) fin();
	if (k%2) reps(i,(k+1)/2,k+1) b[i] -= 2;
	else reps(i,k/2,k+1) b[i] -= 2-(i==k/2);
	rep(i,k+1) if (b[i]) {
		if (b[i]<0) fin();
		else if (i-1<(k+1)/2) fin();
	}
	cout << "Possible" << endl;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

vector<int>E[200000];
int d[200000];
int ans[200000];


int main(){
	int n,m;cin>>n>>m;
	rep(i,m){
		int a,b;scanf("%d%d",&a,&b);a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	queue<int>que;
	memset(d,-1,sizeof(d));
	d[0]=0;que.push(0);
	while(!que.empty()){
		int p=que.front();que.pop();
		for(int u:E[p]){
			if(d[u]==-1){
				d[u]=d[p]+1;
				ans[u]=p+1;
				que.push(u);
			}
		}
	}
	puts("Yes");
	for(int i=1;i<n;i++){
		printf("%d\n",ans[i]);
	}
}

Measured memory_bytes: 13652
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a; 
  int b = 0;
  string str;
  cin >> a >> str;
  for (int i = 0; i < a; i++) {
  if (str[i] == 'A' && str[i+1] == 'B' && str[i+2] == 'C') {
    b++;
  }
  }
  cout << b;
}

Measured memory_bytes: 256
import math


def P(n, r):
    return math.factorial(n)//math.factorial(n-r)


def C(n, r):
    return P(n, r)//math.factorial(r)


N, M = map(int, input().split())
ans = 0
if N >= 2:
    ans += C(N, 2)
if M >= 2:
    ans += C(M, 2)
print(ans)


Measured memory_bytes: 3060
data class Data(val c:Int, val s:Int, val f:Int)
fun main(args:Array<String>) {
  val n = readLine()!!.toInt()
  
  val datasBase = (1..n-1).map { 
    val sp = readLine()!!.split(" ").map(String::toInt)
    val data = Data(sp[0], sp[1], sp[2])
    data
  }

  for( slicer in (0..datasBase.size-1) ) {
    val datas = datasBase.slice(slicer..datasBase.size-1)
    var time = 0
    for( loop in (0..100000) ) {
      if( datas.size-1 < loop ) break
      if( loop == 0 ) {
        time = datas[0].s
        time += datas[0].c
      } else { 
        if( time < datas[loop].s ) {
          // 未発射
          time += (datas[loop].s - time)
          time += datas[loop].c
        } else {
          // 発射済み
          if(  (time - datas[loop].s)%datas[loop].f  != 0 ){ 
            val wait = datas[loop].f - (time - datas[loop].s)%datas[loop].f 
            time += wait 
          }
          time += datas[loop].c
        }
      }
    }
    println(time)
  }
  println(0)
}

Measured memory_bytes: 39448
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define ll long long
#define N 510
using namespace std;
ll l[N][N],r[N][N],f[N][N],g[N][N],dp[N][N];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<i;j++) scanf("%lld",&l[j][i]);
		for(int j=i+1;j<=n;j++) scanf("%lld",&r[i][j]);
	}
	for(int i=0;i<=n+1;i++)
        for(int j=i;j<=n+1;j++)
		{
            f[i][j]=i?f[i-1][j]:0;
            for(int k=j;k<=n+1;k++) f[i][j]+=l[i][k];
        }
    for(int i=n+1;i>=0;i--)
        for(int j=i;j<=n+1;j++)
		{
            g[i][j]=g[i+1][j];
            for(int k=i;k<=j;k++) g[i][j]+=r[i][k];
        }
    memset(dp,60,sizeof(dp));
    dp[0][0]=0;
    for(int i=1;i<=n+1;i++)
    	for(int j=0;j<n;j++)
    		for(int k=0;k<=j;k++)
    		dp[i][j]=min(dp[i][j],dp[j][k]+f[j][i+1]-f[k][i+1]+g[j+1][i]);
    ll ans=1e16;
    for(int i=0;i<=n;i++)
		ans=min(ans,dp[n+1][i]);
    printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 10368
#include <iostream>

using namespace std;

int main() {

  int n;
  int ice[10];

  int a;

  while(1) {

    cin >> n;

    if(n==0) break;

    for(int i=0;i<10;i++) ice[i]=0;

    for(int i=0;i<n;i++) {

      cin >> a;

      ice[a]++;

    }

    for(int i=0;i<10;i++) {

      if(ice[i]==0) cout << "-";

      else for(int j=0;j<ice[i];j++) cout << "*";

      cout << endl;

    }

  }

  return 0;

}

Measured memory_bytes: 0
N, M = map(int, input().split())
Highs = list(map(int, input().split()))
Roads = [list(map(int, input().split())) for _ in range(M)]

winner = set()
looser = set()
appears = set()

def devide(w, l):
    if w not in looser:
        winner.add(w)
    if l not in looser:
        looser.add(l)
    if l in winner:
        winner.remove(l)

def remove(e):
    if e not in looser:
        looser.add(e)
    if e in winner:
        winner.remove(e)

for road in Roads:
    f = road[0]
    t = road[1]

    appears.add(f)
    appears.add(t)

    f_h = Highs[f-1]
    t_h = Highs[t-1]

    if f_h > t_h:
        devide(f, t)
    elif f_h < t_h:
        devide(t, f)
    else:
        remove(t)
        remove(f)

print(len(winner)+N-len(appears))


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

using namespace std;
#define max 10005
int main(){
    long n,a,i=0;
    bool test = true;
    cin >> n;
    for(i; i<n; i++){
      cin >> a;
          if(a%2==0 && a%3!=0 && a%5!=0)
             test = false;
    }
    if(test) cout << "APPROVED" << endl;
    else
      cout << "DENIED" << endl;
    return 0;
}

Measured memory_bytes: 3628
#undef __STRICT_ANSI__
#include <bits/stdc++.h>
using namespace std;
int pd[100001], n, v[100001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>v[i];
    pd[1]=0;
    pd[2]=abs(v[2]-v[1]);
    for(int i=3; i<=n; i++)
        pd[i]=min(pd[i-1]+abs(v[i-1]-v[i]), pd[i-2]+abs(v[i-2]-v[i]));
    cout<<pd[n];
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		System.out.println(Math.abs(x-a)>Math.abs(x-b) ? 'B' : 'A');
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 35780
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int a,wu=0,qi=0;
	cin >> a;
	if(a==5)
		wu++;
	if(a==7)
		qi++;
	cin >> a;
	if(a==5)
		wu++;
	if(a==7)
		qi++;
	cin >> a;
	if(a==5)
		wu++;
	if(a==7)
		qi++;
	if(wu==2&&qi==1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

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

int main(int argc, const char * argv[]){
    
    int n,count = 0;
    int a,b,c,d;
    int sum;
    while(scanf("%d",&n) != EOF){
          if(n > 50 || n < 1)
          exit(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++){
                          sum = a + b + c + d;
                          if((n - sum) == 0)
                              count++;
                      }
                  }
              }
          }
        printf("%d\n",count);
        count = 0;
    }
    return 0;
}

Measured memory_bytes: 596
#pragma once
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#include <ctype.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll bit[200010];
int max_n = 200000;
int pm = 0;
void add(int x) {

	while (max_n >= x)
	{
		bit[x]++;
		x += x & -x;
	}
}
void sub(int x) {
	while (max_n >= x)
	{
		bit[x]--;
		x += x & -x;
	}
}
int search(int x) {

	int k = 0;
	int p = 1;
	while (p * 2 <= max_n)
	{
		p *= 2;
	}
	for (int i = p; i > 0; i /= 2)
	{
		if (i + k < max_n && bit[i + k] < x) {
			x -= bit[i + k];
			k += i;
		}
	}
	return k + 1;
}
void solv() {
	string w;
	cin >> w;
	string s;
	int c = 0;

	for (int i = 0; i < w.size(); i++) w[i] = tolower(w[i]);
	while (cin >> s)
	{
		if (s == "END_OF_TEXT") break;
		for (int i = 0; i < s.size(); i++) s[i] = tolower(s[i]);
		if (s == w)
			c++;
	}
	cout << c << endl;
}
int main() {
	//	COMinit();
	solv();
	return 0;
}



Measured memory_bytes: 3104
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = getLine >>= putStrLn . solve

solve :: String -> String
solve s
    | 0 < x && x < 13 && 0 < y && y < 13 = "AMBIGUOUS"
    | 0 < x && x < 13 = "MMYY"
    | 0 < y && y < 13 = "YYMM"
    | otherwise = "NA" 
    where
        (a, b) = splitAt 2 s
        x = read a :: Int
        y = read b :: Int

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

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

inline void fastRead_int(int &x) {
    register int c = getchar_unlocked();
    x = 0;
    int neg = 0;

    for(; ((c<48 || c>57) && c != '-'); c = getchar_unlocked());

    if(c=='-') {
      neg = 1;
      c = getchar_unlocked();
    }

    for(; c>47 && c<58 ; c = getchar_unlocked()) {
      x = (x<<1) + (x<<3) + c - 48;
    }

    if(neg)
      x = -x;
}

int main(){

	int n, m, mod = 1e9 + 7;
	fastRead_int(n); fastRead_int(m);

	vector<string> grid(n);
	for (int i = 0; i < n; ++i)	{
		cin >> grid[i];
	}
	
	vector< vector<long long int> > dp(n, vector<long long int> (m, 0ll));

	bool wall = false;
	for (int i = 0; i < n; ++i)	{
		if(grid[i][0] == '#'){
			wall = true;
			dp[i][0] = 0;
		}
		else if(!wall && grid[i][0] == '.')	dp[i][0] = 1;
	}

	wall = false;
	for (int j = 0; j < n; ++j)	{
		if(grid[0][j] == '#'){
			wall = true;
			dp[0][j] = 0;
		}
		else if(!wall && grid[0][j] == '.')	dp[0][j] = 1;
	}

	for (int i = 1; i < n; ++i)	{
		for (int j = 1; j < m; ++j)	{
			if(grid[i][j] == '.')dp[i][j] = (dp[i-1][j] + dp[i][j-1])%mod;
		}
	}

	printf("%lld\n", dp[n-1][m-1]);

	return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll>> pqls;
priority_queue <P,vector<P>,greater<P>> pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans;
ll a,b,d,e,f,g,h,w;
 
ll x[800005],y[800005],z[900005];
char s[500005];
ll dp[5000][5000];

int main(){
    cin>>n;
	for(i=1;i<=n;i++){
		num = 0;
		for(j=1;j<=n;j++){
			if(i%j==0)num++;
		}
		if(i%2==1 && num==8)ans++;
	}
	p(ans);
	return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int x,y,a,b,c;
  cin >> x >> y>> a>> b>> c;
  vector<int> p(a),q(b),r(c);
  ll res=0;

  rep(i,a) cin >> p[i];
  rep(i,b) cin >> q[i];
  rep(i,c) cin >> r[i];

  sort(p.begin(),p.end(), greater<int>());
  sort(q.begin(),q.end(), greater<int>());
  sort(r.begin(),r.end(), greater<int>());

  ll sumx=0, sumy =0;
  rep(i,x) sumx += p[i];
  rep(i,y) sumy += q[i];
  res = sumx + sumy;
  int ix = x-1 , iy = y-1, iz = 0;
  rep(i, c) {
    int pp = (ix >= 0) ? p[ix] : INF;
    int qq = (iy >= 0) ? q[iy] : INF;
    int m = min(pp, qq);
    if( m < r[i] ){
      res += r[i] - m;
      if(pp < qq) ix--;
      else iy--;
    }
  }

  cout << res << endl;
}


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

#[macro_use]
mod _input {
    use std::fmt;
    use std::io::{self, Read};
    use std::str::{self, FromStr};

    macro_rules! input {
        ($($name:ident : $t:tt),*,) => {
            input!($($name: $t),*)
        };
        ($($name:ident : $t:tt),*) => {
            let mut _scanned = ::_input::Scanned::new(::std::io::stdin(), 1024);
            $(
                let $name = unsafe { _read_value!(_scanned, $t) };
            )*
        };
    }

    macro_rules! _read_value {
        ($scanned:expr, ($($t:tt),*)) => {
            ($(_read_value!($scanned, $t)),*)
        };
        ($scanned:expr, [$t:tt; $n:expr]) => {
            (0..$n).map(|_| _read_value!($scanned, $t)).collect::<Vec<_>>()
        };
        ($scanned:expr, _bytes) => {
            _read_value!($scanned, String).into_bytes()
        };
        ($scanned:expr, _1based) => {
            _read_value!($scanned, usize) - 1
        };
        ($scanned:expr, $t:ty) => {
            $scanned.next::<$t>()
        };
    }

    pub struct Scanned {
        buf: Vec<u8>,
        pos: usize,
    }

    impl Scanned {
        pub fn new<R: Read>(mut input: R, estimated: usize) -> Self {
            let mut buf_ = Vec::with_capacity(estimated);
            let _ = io::copy(&mut input, &mut buf_).unwrap();
            debug_assert!(str::from_utf8(&buf_).is_ok());
            debug_assert!(buf_.iter().all(|&c| u32::from(c) <= 0x7F));
            Scanned { buf: buf_, pos: 0 }
        }

        #[inline]
        pub unsafe fn next<T: FromStr>(&mut self) -> T
        where
            T::Err: fmt::Debug,
        {
            let mut start = None;
            loop {
                match (self.buf[self.pos], start.is_some()) {
                    (b' ', true) | (b'\n', true) => break,
                    (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                    (_, false) => start = Some(self.pos),
                }
            }
            let target = &self.buf[start.unwrap()..self.pos];
            str::from_utf8_unchecked(target).parse().unwrap()
        }
    }
}

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Stderr, StderrLock, Stdout, StdoutLock, Write};
use std::iter::{self, Product, Sum};
use std::num::{ParseFloatError, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Deref,
    DerefMut, Div, DivAssign, Mul, MulAssign, Neg, Not, Rem, RemAssign, Sub, SubAssign,
};
use std::str::{self, FromStr};
use std::{char, cmp, f32, f64, fmt, i16, i32, i64, i8, mem, thread, u16, u32, u64, u8};

fn main() {
    input! {
        n: u64,
        k: u64,
    }
    let r = n - k + 1;
    println!("{}", r);
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;
    int n=s.size();
    vector<int> dp(n,n+2);
    vector<char> p(n,'0');
    auto best=[&](int i,int len,char to)
    {
        if(len<dp[i]||(len==dp[i]&&to<p[i]))
        {
            dp[i]=len;
            p[i]=to;
        }
    };
    vector<int> nxt(26,-1);
    for(int i=n-1;i>=0;i--)
    {
        for(int j=0;j<26;j++)
        {
            if(nxt[j]==-1) best(i,1,j+'a');
            else best(i,dp[nxt[j]]+1,j+'a');
        }
        nxt[s[i]-'a']=i;
    }
    for(int i=0;i<26;i++)
    {
        if(nxt[i]==-1)
        {
            cout << (char)(i+'a') << "\n";
            return 0;
        }
    }
    int src=0;
    for(int i=0;i<n;i++)
    {
        if(nxt[s[i]-'a']==i&&(dp[i]<dp[src]||(dp[i]==dp[src]&&s[i]<s[src]))) src=i;
    }
    cout << s[src];
    int idx=src;
    while(1)
    {
        char now=p[idx];
        cout << now;
        idx++;
        while(idx<n&&s[idx]!=now) idx++;
        if(idx==n) break;
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 4504
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long

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

	int N, M;
	int a[50] = { 0 };
	cin >> N >> M;
	for (int i = 0; i < N; i++)
	{
		int K;
		cin >> K;
		for (int j = 0; j < K; j++)
		{
			int tmp;
			cin >> tmp;
			a[tmp]++;
		}
		//cout << "a" << endl;
	}
	int cnt = 0;
	for (int i = 0; i <= M; i++)
	{
		if (a[i] == N)
		{
			cnt++;
		}
		//cout << "b" << endl;
	}

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
lis=[input() for i in range(h)]
outs=[]
for x in range(h):
    s=""
    for y in range(w):
        if lis[x][y]==".":
            c=0
            for xi,yi in [(1,1),(1,0),(1,-1),(0,1),(0,-1),(-1,1),(-1,0),(-1,-1)]:
                if not (xi+x==-1 or yi+y==-1 or xi+x==h or yi+y==w):
                    c+=(1 if lis[xi+x][yi+y]=="#" else 0)
            s+=str(c)
        else:
            s+="#"
    outs.append(s)
for i in outs:
    print(i)


Measured memory_bytes: 3064
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
string s;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(input())
t = list(input())

res = 0
for i in range(n):
    r = 0
    c = 0
    for j in range(n-i):
        if s[i+j] == t[j] and c == 0:
            r += 1
        else:
            c = 1
    if r == n-i:
        res = n+i
        break

if res == 0:
    res = 2*n
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
int main() {
	string s;cin>>s;
	if(s[0]==s[1]) return cout<<"1 2"<<endl,0;
	for(int i=2;i<s.length();i++) {
		if(s[i]==s[i-1]) return cout<<i<<' '<<i+1<<endl,0;
		vector<char >V;
		for(int j=0;j<=2;j++) 
			V.push_back(s[i-j]);
		sort(V.begin(),V.end());
		if(V[0]==V[1]||V[1]==V[2]) {
			cout<<i-2+1<<' '<<i+1<<endl;
			return 0;
		}
	}
	puts("-1 -1");
    return 0;
}

Measured memory_bytes: 3748
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

ans = 0
for i in range(N):
    d = min(A[i], B[i])
    ans += d
    A[i] -= d
    B[i] -= d
    d = min(A[i+1], B[i])
    ans += d
    A[i+1] -= d
    
print(ans)


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

#define ll long long int
#define pb push_back
#define RONALDO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<ll, ll>
#define ff first
#define ss second
#define mod 1000000007
#define vi vector<ll>
#define mi map<ll, ll>
#define Max(x, y, z) max(x, max(y, z))
#define Min(x, y, z) min(x, min(y, z))

//LOVE U MESSI && CRistiano !!

//INSPIRATIONAL MICHAEL PHELPS && USAIN BOLT !!

int main(){
RONALDO;
string s;
cin >> s;
if(s[s.length()-1]=='s')
    cout << s + "es";
else    
    cout << s +'s';
return 0;
}

Measured memory_bytes: 3680
/*
float like a butterfly
sting like a Bee

?#%^*&~`!  YOUR ONLY LIMIT IS YOUR MIND

*/

#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define q '\n'

using namespace std;

lli x, y;

int main() {
	cin >> x >> y;
	if (y % 2 == 1){
		cout << "No";
	}else {
		if (4 * x >= y && y >= 2 * x){
			cout << "Yes";
		}else {
			cout << "No";
		}
	}
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio> 
char s[100005],t[100005];  
int sp[100005],tp[100005],q,a,b,c,d,i;  
int main(){  
    scanf("%s%s%d",s+1,t+1,&q);  
    for(i=1;s[i];++i)  sp[i]=sp[i-1]+s[i]-'A'+1;  
    for(i=1;t[i];++i)  tp[i]=tp[i-1]+t[i]-'A'+1;  
    while(q--){  
        scanf("%d%d%d%d",&a,&b,&c,&d);
        if((sp[b]-sp[a-1])%3==(tp[d]-tp[c-1])%3) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


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

int main(){

  int N, A, B, C, D;
  cin >> N;
  A = N / 1000;
  B = (N / 100) % 10;
  C = (N / 10) % 10;
  D = N % 10;
  
  if (B==C){
    if (A==B || C==D){
    	cout << "Yes" << endl;
    } else {
    	cout << "No" << endl;
    }
  } else {
    cout << "No" << endl;
  }

}


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

bool IsNotElem( std::vector<int>& done, int x ){
    for( const auto& g : done ){
        if( g == x ){
            return false;
        }
    }
    done.push_back(x);
    return true;
}

int main(){
    int n;
    std::cin >> n;
    std::vector<int> S(n);
    for( auto& e : S ){
        std::cin >> e;
    }
    
    int q;
    std::cin >> q;
    std::vector<int> T(q);
    for( auto& e : T ){
        std::cin >> e;
    }

    int num = 0;
    std::vector<int> done;
    for( const auto& e : S ){
        for( const auto& f : T ){
            if( e == f && IsNotElem( done, e ) ){
                ++num;
            }
        }
    }
    std::cout << num << '\n';
}


Measured memory_bytes: 3160
macro_rules! read_line {
    () => {{
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        input
    }};
}
fn read_and_parse<T: std::str::FromStr>() -> T {
    read_line!().trim().parse().ok().unwrap()
}
fn main() {
    let x: i32 = read_and_parse();

    if x % 10 == 7
        || x / 10 % 10 == 7
            || x / 100 % 10 == 7 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2104
#include<stdio.h>

int main()
{
	int n=0, i;
	char s[5];
	scanf("%s", s);
	for (i = 0; i < 4; i++){
		if (s[i] == '+'){
			n++;
		}
		else{
			n--;
		}
	}
	printf("%d", n);
	return 0;
}

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

typedef long long ll;

int main() {
	ll l, r;
	ll mod=2019;
	cin >> l >> r;
	for (ll i = l; i <= r; i++) {
		for (ll j = i + 1; j <= r; j++) {
			mod = min(mod,(i*j)%2019);
			if (mod == 0) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	cout << mod << endl;

	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) (v).begin(), (v).end()

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> v(h);
  vector<bool> flagcol(w, false);
  vector<bool> flagrow(h, false);
  rep(i, h) {
    cin >> v[i];
  }
  // 行チェック
  rep(i, h) {
    rep(j, w) {
      if(v[i][j] == '#') {
        flagrow[i] = true;
        break;
      }
    }
  }
  // 列チェック
  rep(j, w) {
    rep(i, h) {
      if(v[i][j] == '#') {
        flagcol[j] = true;
        break;
      }
    }
  }

  rep(i, h) {
    if(flagrow[i] == false) continue;
    rep(j, w) {
      if(flagcol[j] == false) continue;
      cout << v[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<set>
#define ll long long
using namespace std;


int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
	int k,a,b;
	cin>>k>>a>>b;
	int aa=(a-1)/k,bb=b/k;
	if(aa==bb)cout<<"NG";
	else cout<<"OK"; 
    return 0;
}



Measured memory_bytes: 3624
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int W=sc.nextInt();
    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	
    	int result=0;

    	if(b-(a+W)>=0) {
    		result=b-(a+W);
    	}else if(a-(b+W)>=0) {
    		result=a-(b+W);
    	}

    	System.out.println(result);
    }

}



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

int main(){
  int n;
  string s;

  scanf("%d\n", &n);
  while(n--){
    getline(cin, s);
    vector<string> ans;
    stringstream ss(s);
    string t;
    while(getline(ss, t, ' ')){
      int i=0;
      while((i=t.find("Hoshino", i))!=string::npos){
        t.replace(i, 7, "Hoshina");
      }
      ans.push_back(t);
    }
    for(int i=0; i<ans.size(); i++){
      if(i!=ans.size()-1)cout<<ans[i]<<' ';
      else cout<<ans[i]<<endl;
    }
  }
  return 0;
}

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

int main(void)
{
  long int n;
  scanf("%ld", &n);
  
  long int* array = malloc(n * sizeof(long int));
  
  int i, j;
  for (i = 0; i < n; ++i)
  {
    scanf("%ld", &array[i]);
  }
  
  long int a = 0;
  for (i = 0; i < n; ++i)
  {
    a ^= array[i];
  }
  long int ans;
  for (i = 0; i < n; ++i)
  {
    ans = a ^ array[i];
    printf("%ld ", ans);
  }
  printf("\n");
  
  
  free(array);
  
  return 0;
}


Measured memory_bytes: 4028
#include <iostream>

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

using namespace std;

static const bool PATTERN[11][7] =
{
	0, 1, 1, 1, 1, 1, 1,
	0, 0, 0, 0, 1, 1, 0,
	1, 0, 1, 1, 0, 1, 1,
	1, 0, 0, 1, 1, 1, 1,
	1, 1, 0, 0, 1, 1, 0,
	1, 1, 0, 1, 1, 0, 1,
	1, 1, 1, 1, 1, 0, 1,
	0, 1, 0, 0, 1, 1, 1,
	1, 1, 1, 1, 1, 1, 1,
	1, 1, 0, 1, 1, 1, 1,
	0, 0, 0, 0, 0, 0, 0
};

static const int DEFAULT = 10;

int main(void){
	for(int n; cin >> n, n != -1;){
		int preNum = DEFAULT;
		while(n --){
			int num; cin >> num;
			rep(i, 7) cout << (PATTERN[preNum][i] ^ PATTERN[num][i]);
			cout << endl;
			preNum = num; 
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main()
{
	int a, b, c, i, j;

	i = 0;
	j = 0;

	while(scanf("%d,%d,%d", &a, &b, &c) != EOF){
		if(a+b > c && b+c > a && a+c > b){
			if(a*a + b*b == c*c) i++;
			if(a == b) j++;
		}
	}

	printf("%d\n%d\n", i, j);

	return 0;
}

Measured memory_bytes: 596