akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int intpow(int a, int n) {
	// a^nのint ver
	rep(i, n - 1)
		a *= a;
	return a;
}
int MODPOW(int a, int n, int mod) {
	// a^n mod
	int ans = 1;
	while (n > 0) {
		if (n & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int MODFACT(int a, int mod) {
	if (a == 0)
		return 1;
	else
		return (a * FACT(a - 1)) % mod;
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int MODnPr(int n, int r, int mod) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++) {
		sum *= i;
		sum = sum % MOD;
	}
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	//約数の数（だっけ？）
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	//1桁目切り上げ
	return (n + 9) / 10 * 10;
}
int DIGIT(int n, int k) {
	//nのk桁目
	rep(i, k - 1)
		n /= 10;
	return n % 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	//nをkで何回割れるか的な
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
int binary(int n) {
	//10進数→2進数
	int ans = 0;
	for (int i = 0; n > 0; i++) {
		ans += n % 2 * intpow(10, i);
		n /= 2;
	}
	return ans;
}
int intabs(int n) {
	if (n < 0)
		return -1 * n;
	else
		return n;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion

signed main() {
	int N,ans=0;
	cin >> N;
	REP(i, N) {
		if (i % 3 != 0 && i % 5 != 0)
			ans += i;
	}
	cout << ans;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(v) (v).size()
#define all(v) (v).begin(),(v).end()
using namespace std;
template <typename T> T Max(T X,T Y){return X>Y?X:Y;}
template <typename T> T Min(T X,T Y){return X<Y?X:Y;}
template <typename T> void chmax(T &X,T Y){X=X>Y?X:Y;return;}
template <typename T> void chmin(T &X,T Y){X=X<Y?X:Y;return;}

int k;
string s;

int main()
{
	cin>>k;
	cin>>s;
	if(sz(s)<=k) cout<<s<<endl;
	else
	{
		for(int i=0;i<k;i++)
			cout<<s[i];
		cout<<"..."<<endl;
	}
	return 0;
}

Measured memory_bytes: 3624
import sys
sys.setrecursionlimit(1000000)

N = int(input())

G = [set() for i in range(N)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    G[a-1].add((b, c))
    G[b-1].add((a, c))

Q, K = map(int, input().split())

visited = [False] * N
visited[K-1] = True

distance = [-1]*N


def dfs(v, p, d):  # 現在の頂点v, vの親p, 現在の距離d
    distance[v-1] = d
    for i, c in G[v-1]:
        if visited[i-1] is False:
            if i == p:
                continue
            dfs(i, v, d+c)
    return


dfs(K, -1, 0)

for i in range(Q):
    x, y = map(int, input().split())
    print(distance[x-1]+distance[y-1])


Measured memory_bytes: 145404
sin = input()
n = int(sin)
sin = input()
arr = list(map(int, sin.split()))

db = list()
for i in range(n):
    db.append([arr[i], i+1])

ll = list()
for a in sorted(db, key=lambda x: x[0]):
    ll.append(a[1])

print(' '.join(map(str, ll)))

Measured memory_bytes: 28944
#include<cstdio>
#include<algorithm>
using namespace std;

int n, a[101];
bool ok[101];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 1; j <= n + 1; j++) ok[j] = false;
    ok[0] = true;
    for (int k = 1; k <= n + 1; k++) {
      if (a[k] == 1) continue;
      for (int j = i; j >= 1; j--) {
        if (ok[k - j]) {
          ok[k] = true;
          break;
        }
      }
    }
    if (ok[n + 1]) {
      printf("%d\n", i);
      break;
    }
  }
}



Measured memory_bytes: 2732
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<cctype>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;

int main(){

  ll N;

  cin >> N;


  cout << ( N >= 30 ? "Yes" : "No" )<< endl;

  return 0;

}   


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

int main(){
    
    int X;
    
    cin >> X;
    
    int sum = 0;
    
    int a = X;
    
    while(1){
        sum += X % 10;
        if(X / 10 == 0){
            break;
        }
        X /= 10; 
    }
    if(a % sum == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}
   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b;cin >> a >> b;
  if(a<6){
      b=0;
  }else if(a<=12){
      b/=2;
  }
  cout << b << endl;


}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	ll a, b, c, x, y;
	cin>>a>>b>>c>>x>>y;
	ll ans = a*x + b*y;
	ans = min(ans, max(x, y)*2*c);
	if(x < y){
		ans = min(ans, 2*c*x + (y - x)*b);
	}else{
		ans = min(ans, 2*c*y + (x - y)*a);
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[50][26];
string s;

int main() {
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> s;
        for(int j=0;j<s.size();j++){
            a[i][s[j]-'a']++;
        }
    }
    s.clear();
    int com;
    for(int i=0;i<26;i++){
        com=1e9;
        for(int j=0;j<n;j++){
            com=min(com,a[j][i]);
        }
        string ss="";
        for(int j=0;j<com;j++){
            ss.push_back(char(i+'a'));
        }
        s+=ss;
    }
    sort(s.begin(),s.end());
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
a,b = map(int,input().split())

def prime_factorize(n):
    a = {}
    while n % 2 == 0:
        if 2 in a:
            a[2] += 1
        else:
            a[2] = 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if f in a:
                a[f] += 1
            else:
                a[f] = 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] = 1
    return a

a_primes = prime_factorize(a).keys()
b_primes = prime_factorize(b)

reply_list = []
for p in a_primes:
    if p in b_primes:
        reply_list.append(p)

print(len(reply_list) + 1)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int N = 2005;
int f[N];
int main()
{
    int s;
    scanf("%d", &s);

    for (int i = 3; i <= s; ++i)
        f[i] = 1;

    for (int i = 3; i <= s; ++i)
    {
        for (int j = 3; j <= i; ++j)
            f[i] = ((ll)f[i] + f[i - j]) % mod;
    }

    printf("%d\n", f[s]);


    return 0;
}

Measured memory_bytes: 3788
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    
    // Atcoderは固定なので捨て
    scanner.next();
    
    // 2つ目の単語を取得
    String word = scanner.next();
    
    // 単語の頭文字を取得
    String head = word.split("")[0];
    
    // "A" + head + "C" を出力
    System.out.println("A" + head + "C");
  }
}

Measured memory_bytes: 38516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ii {
    int a, b;
    bool operator < (ii o) const {
        return tie(a, b) < tie(o.a, o.b);
    }
};
struct iii {
    int a, b, c;
    bool operator < (iii o) const {
        return tie(a, b, c) < tie(o.a, o.b, o.c);
    }
};

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 1000005;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    
    ll end = X;
    if (X < (double)K*D) end = ((X-(K%2)*D)%(2*D) - 2*D)%(2*D);
    else end = X-K*D;
    
    ll ans = abs(end);
    if (end < end%(2*D) + 2*D) ans = min(ans, abs(end%(2*D) + 2*D)); 
    cout << ans << "\n";
    
}


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

const int k = 10000;

void countingSort(int A[], int B[], int n, int k) {
    int C[k + 1];
    for(int j = 0; j < k + 1; j++) C[j] = 0;
    for(int i = 0; i < n; i++) C[A[i]]++;
    for(int j = 1; j < k + 1; j++) C[j] += C[j - 1];
    for(int i = n - 1; i > -1; i--) {
        B[C[A[i]] - 1] = A[i];
        C[A[i]]--;
    }
}

int main() {
    int n;
    cin >> n;
    int A[n], B[n];
    for(int i = 0; i < n; i++) cin >> A[i];

    countingSort(A, B, n, k);

    for(int i = 0; i < n; i++) {
        if(i) cout << " ";
        cout << B[i];
    }
    cout << endl;
}


Measured memory_bytes: 18756
using System;

class Program {
    static int Main(string[] args) {
        string v = Console.ReadLine();
        int S = int.Parse(v);
        int h = S / 3600;
        int m = (S - h * 3600) / 60;
        int s = S - h * 3600 - m * 60;
        Console.WriteLine(string.Format("{0}:{1}:{2}", h, m, s));
        return 0;
    }
}

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

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


points = []
for _ in range(5):
    points.append(d_in())
k = d_in()

max_dist = -1
for i in range(5):
    for j in range(i+1, 5):
        max_dist = max(max_dist, abs(points[i] - points[j]))

if max_dist <= k:
    print('Yay!')
else:
    print(':(')


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

int main(){
  int n, W;
  cin >> n >> W;
  int v[n], w[n];
  rep(i,n) cin >> v[i] >> w[i];
  vector<int> dp(W+1);
  rep(i,n) {
    rep(j,W+1) {
      if(j > 0) dp[j] = max({dp[j],dp[j-1]});
      if(j >= w[i]) dp[j] = max(dp[j],dp[j-w[i]]+v[i]); 
    }
  }
  cout << dp[W] << endl;
  return 0;
}


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

ll n,m,v,p; 
vll a;
bool isOk(ll mid){
  if(mid<=p-1) true;
  ll point=a[mid]+m;
  if(a[p-1]>point) return false;
  ll total=(p-1)*m+(n-mid)*m;
  irep(i,p-1,mid){
    total+=min(m,point-a[i]);
  }
  return total>=m*v;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  cin>>n>>m>>v>>p;
  a.resize(n);
  rep(i,n) cin>>a[i];
  sort(a.rbegin(),a.rend());
  ll ans=p;
  ll ok=-1, ng=n;
  while(abs(ok-ng)>1){
    ll mid=(ok+ng)/2;
    if(isOk(mid)) ok=mid;
    else ng=mid;
  }
  cout<<ok+1<<endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String pText = std.next();
        String aText = std.next();
        String[] ps = pText.split("");
        String[] as = aText.split("");
        int result = IntStream.range(0, ps.length)
                .reduce(0, (acc, it) -> {
                    String p = ps[it];
                    String a = as[it];
                    if (p.equals(a)) {
                        acc++;
                    }
                    return acc;
                });

        System.out.println(result);
    }
}


Measured memory_bytes: 28624
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int ans = 0;
    int enda = 0;
    int beginb = 0;
    int both = 0;
    rep(i, n) {
        string s;
        cin >> s;
        if (s.front() == 'B' && s.back() == 'A') both++;
        else if (s.front() == 'B') beginb++;
        else if (s.back() == 'A') enda++;
        
        rep(j, sz(s) - 1) {
            if (s[j] == 'A' && s[j+1] == 'B') ans++;
        }
    }
    if (both > 0 && enda > 0 && beginb > 0) {
        ans += both+1;
        enda--; beginb--;
        ans += min(enda, beginb);
    } else if (both == 0) {
        ans += min(enda, beginb);
    } else if (both > 0 && enda == 0 && beginb == 0) {
        ans += both-1;
    } else {
        ans += both;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll a, b;
    cin >> a >> b;
    if (a <=8 && b <= 8) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<vector<double>>dp;
double f(int i,int t,vector<double>&p)
{
    if(t<0)
    return 0;
    if(i==-1)
    return 1;
    if(dp[i][t]!=-1)
    return dp[i][t];
    double x1=((double)p[i])*f(i-1,t,p);
    double y=((double)(1-p[i]))*f(i-1,t-1,p);
    return dp[i][t]=x1+y;
}

int main()
{
    int n;
    cin>>n;
    vector<double>p(n);
    for(auto &i:p)
    cin>>i;
    int x=(n)/2;
    dp.resize(n+1,vector<double>(x+1,-1));
    cout<< setprecision(10) <<f(n-1,x,p);
}

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

using namespace std;
struct I{
    I(){
        ios::sync_with_stdio(false);cin.tie(0);
        //cout<<fixed<<setprecision(10);
    }
}init;

typedef long long LL;
const LL MOD=1e9+7;


int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(auto &it:A)cin>>it;
    LL res=0;
    for(int i=0;i<N;i++){
        res+=A[i]/2;
        A[i]%=2;
        while(i+1<N&&A[i]>0&&A[i+1]>0){
            res++;
            A[i]--;
            A[i+1]--;
        }
    }
    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fine cout<<"fine"<<endl;
#define ll long long int
#define pb push_back
#define FASTIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
const ll inf=(ll)2e18;
const int mod=1e9+7;
bool overflow(ll a,ll b){
    if (a <= (inf+b-1)/b) return false;
    return true;
}
int main(){
FASTIO;
int x;
cin>>x;
cout<<(!x)<<endl;
}


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

int N;
const int MAX_N = 1.0e5 + 100;
ll A[MAX_N];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];

    sort(A, A+N, greater<>());

    ll ans = 0;
    if (N % 2 == 0) {
        for (int i = 0; i < N; i++) {
            if (i < N/2 - 1) ans += 2*A[i];
            else if (i == N/2 - 1) ans += A[i];
            else if (i == N/2) ans -= A[i];
            else ans -= 2*A[i];
        }
    }
    else {
        ll a1 = 0;
        for (int i = 0; i < N; i++) {
            if (i < N/2 - 1) a1 += 2*A[i];
            else if (i == N/2 - 1) a1 += A[i];
            else if (i == N/2) a1 += A[i];
            else a1 -= 2*A[i];
        }
        ll a2 = 0;
        for (int i = 0; i < N; i++) {
            if (i < N/2) a2 += 2*A[i];
            else if (i == N/2) a2 -= A[i];
            else if (i == N/2 + 1) a2 -= A[i];
            else a2 -= 2*A[i];
        }
        ans = max(a1, a2);
    }

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


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	int a, b;
	char op,ch;
	scanf("%d",&a);
	scanf("%c",&ch);
	scanf("%c",&op);
	scanf("%d",&b);
	if(op=='+')
		printf("%d\n",a+b);
	else if(op=='-')
		printf("%d\n",a-b);
	return 0;
}

Measured memory_bytes: 1728
N = int(input())
A = [int(x) for x in input().split()]
mi = max(A)
an = 10000000000000
b = 0
for i in range(N):
  if an>abs(mi//2-(mi-A[i])) and A[i]!=mi:
    an = abs(mi//2-(mi-A[i]))
    b = A[i]
print(mi,b)

Measured memory_bytes: 62704
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	string s; cin >> s;
	int i; int len = s.length(); bool f = true;
	if (len == 2) {
		if (s[0] == s[1])cout << "1 2" << endl;
		else cout << "-1 -1" << endl;
		return 0;
	}
	for (i = 0; i < len - 2; i++) {
		if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			f = false; break;
		}
	}
	if (f) {
		cout << "-1 -1" << endl;
	}
	return 0;
}

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

void solve()
{
 int x;cin>>x;
 if(x>=400 && x<=599)
 cout<<8<<endl;
 else if(x>=600 && x<=799)
 cout<<7<<endl;
 else if(x>=800 && x<=999)
 cout<<6<<endl;
 else if(x>=1000 && x<=1199)
 cout<<5<<endl;
 else if(x>=1200 && x<=1399)
 cout<<4<<endl;
 else if(x>=1400 && x<=1599)
 cout<<3<<endl;
 else if(x>=1600 && x<=1799)
 cout<<2<<endl;
 else
 cout<<1<<endl;
}

int32_t main()
{
    rapido;
    int t;
    //cin>>t;
    t=1;
    
   while(t--)
   solve();
}





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

int N, cnt[10][10];
LL answer;

int main() {
    cin >> N;

    for (int i = 1; i <= N; i++) {
        int number = i;

        int lastDigit = number%10;

        while (number >= 10) number /= 10;

        int firstDigit = number;

        cnt[firstDigit][lastDigit] += 1;
    }

    answer = 0;
    for (int f = 1; f <= 9; f++) {
        for (int s = 1; s <= 9; s++) {
            answer += ((LL) cnt[f][s] * cnt[s][f]);
        }
    }

    cout << answer << endl;
}


Measured memory_bytes: 256
H,W = [int(_) for _ in input().split()]
HW = [[0]*W for _ in range(H)]
for i in range(H):
    c = 0
    for j in [int(_) for _ in input().split()]:
        if j == 1:
            HW[i][c] = 1
        c += 1
dp = [[0]*W for _ in range(H)]
for j in range(W):
    if HW[0][j] == 0:
        dp[0][j] = 1
    else:
        dp[0][j] = 0
for i in range(H):
    if HW[i][0] == 0:
        dp[i][0] = 1
    else:
        dp[i][0] = 0
for i in range(1, H):
    for j in range(1, W):
        if HW[i][j] == 1:
            dp[i][j] = 0
        else:
            dp[i][j] = min(dp[i-1][j],dp[i-1][j-1],dp[i][j-1]) + 1
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans,dp[i][j])
print(ans*ans)



Measured memory_bytes: 55028
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int P[N];
    for(int i = 0; i < N; i++) cin >> P[i];
    int length[N + 1];
    for(int i = 0; i <= N; i++) length[i] = -1;
    int maximum = 1;
    for(int i = 0; i < N; i++) {
        length[P[i]] = max(1, length[P[i] - 1] + 1);
        maximum = max(maximum, length[P[i]]);
    }
    cout << N - maximum << "\n";
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdlib>
#include <vector>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long

int main(void){
    string s, t;
    cin >> s >> t;
    ll a, b;
    cin >> a >> b;
    string c;
    cin >> c;
    if(s==c)
        a--;
    else
        b--;
    cout << a << " " << b << endl;
    return 0;
}

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

int main()
{
	int a,b;
	cin>>a>>b;
	int s=1^2^3;
	int c=a^b;
	int d=c^s;
	cout<<d;
}
	


	
	
	
   



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

using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;

#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007
void printbit(int u){if(u==0)cout<<0;else{int s=0,k=0;for(;0<u;u>>=1,k++)s=(s<<1)|(u&1);for(;0<k--;s>>=1)cout<<(s&1);}}

#define TIME chrono::system_clock::now()
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())

template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}

ll gcd(ll m,ll n){
	if ((0==m) || (0==n))
		return 0;
	while(m!=n){
		if (m>n) m=m-n;
		else n=n-m;
	}
	return m;
}

ll lcm(ll m,ll n){
    return ((m/gcd(m,n))*n);
}


int main(){
    int n;
    ll i,j,k,l;
    
    ll it,ia;
    
    cin >> n;
    ll tak=0,aok=0;
    
    cin>>tak>>aok;
    int loop=0;
    for (i=1;i<n;i++){
        cin>>it>>ia;
        for (j=max(tak/it,aok/ia);;j++){
            loop++;
            if (tak<=it*j && aok<=ia*j) break;
        }
        tak = it*j;
        aok = ia*j;
    }
    cerr << loop << endl;
    cout << (tak+aok) << endl;
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);i++)
#define erep(i,a,b) for(int i=a;i<=(int)(b);i++)
#define per(i,a,b) for(int i=(b)-1;i>(a);i--)
#define eper(i,a,b) for(int i=((int)(a));i>=b;i--)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
using namespace std;
typedef long long ll;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s, t;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> s >> t;
    int n = s.size(), m = t.size();
    bool ans = false;
    eper(i, n-m, 0) {
        bool flag = false;
        rep(j, i, i+m) {
            if (s[j] == '?') continue;
            else if (s[j] != t[j-i]) {
                flag = true;
                break;
            }
        }
        if (!flag) {
            s = s.erase(i, m);
            s.insert(i, t);
            ans = true;
            break;
        }
    }
    rep(i, 0, n) {
        if (s[i] == '?') s[i] = 'a';
    }
    if (!ans) cout << "UNRESTORABLE" << endl;
    else cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <ctime>

#define inf 0x3f3f3f3f
#define Inf 0x3FFFFFFFFFFFFFFFLL
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define Rep(i, n) for (int i = 1; i <= (n); ++i)
#define clr(x, a) memset(x, (a), sizeof x)
using namespace std;
typedef long long ll;

int main() {
  int a,b; cin >> a >> b;
  Rep(i, 10000) {
    int x = 0.08 * i;
    int y = 0.1 * i;
    if (x == a && y == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}



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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

template <int mod>
struct ModInt {
  int x;
  ModInt(): x(0) {}
  ModInt(long long a) { x = a % mod; if (x < 0) x += mod; }
  ModInt &operator+=(ModInt that) { x = (x + that.x) % mod; return *this; }
  ModInt &operator-=(ModInt that) { x = (x + mod - that.x) % mod; return *this; }
  ModInt &operator*=(ModInt that) { x = (long long) x * that.x % mod; return *this; }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return ModInt(u);
  }
  #define op(o, p) ModInt operator o(ModInt that) { return ModInt(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  friend ostream& operator<<(ostream &os, ModInt m) { return os << m.x; }
};

using mint = ModInt<1000000007>;

void solve() {
  int n, m;
  cin >> n >> m;
  vi32 a(m);
  cin >> a;
  vector<mint> dp(n + 1);
  dp[0] = 1;
  rep(i, n) {
    int x = i + 1;
    int y = i + 2;
    if (x > n) continue;
    if (x <= n && !binary_search(all(a), x)) dp[x] += dp[i];
    if (y <= n && !binary_search(all(a), y)) dp[y] += dp[i];
  }
  cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    while(true){
        ll N, X;
        cin >> N >> X;
        if (N == 0 && X == 0) break;

        ll ans = 0;
        repe(i,1,N){
            repe(j,i+1,N+1){
                ll k = X - i - j;
                if (k <= j || k > N) continue;

                ans++;
            }
        }
        cout << ans << endl;
    }
}


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

int main(){
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> p(n, k-q);//p(配列の長さ, 初期値)。初期値がk-qなのはq回みんな、-1されるからkからq引いとくってこと
  rep(i,q) {
    int a;
    cin >> a;
    --a;//みんな、-1する
    p[a]++;//a番目の人を1点加算
  }
  rep(i,n) {
    if (p[i]<=0) puts("No");//putsは文字列を出力し、自動で改行してくれるもの
    else puts("Yes");
    }
    return 0;
}

Measured memory_bytes: 1024
#include <string>
#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <bitset>
using namespace std;
int n, m;
int main()
{
    cin>>n >> m;
    if (m == 1) cout << '0';
    else
        cout << n - m;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
ll modpow(ll x, ll n){
	ll r=1;
	while(n){
		if(n&1) r=r*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return r;
}
int main(){
  ll n;cin>>n;
  vll k(n);
  rep(i,0,n){
    ll a;cin>>a;
    k[a]++;
  }
  if(n%2){
    bool ok=false;
    if(k[0]!=1){ok=true;}
    rep(i,2,n){
      if(i%2==0&&k[i]!=2){
        ok=true;
      }
      if(i%2&&k[i]!=0){
        ok=true;
      }
    }
    if(ok){cout<<0<<endl;}
    else{
      cout<<modpow(2,n/2)<<endl;
    }
  }
  else{
    bool ok=false;
    rep(i,0,n){
      if(i%2&&k[i]!=2){
        ok=true;
      }
      if(i%2==0&&k[i]!=0){
        ok=true;
      }
    }
    if(ok){cout<<0<<endl;}
    else{cout<<modpow(2,n/2)<<endl;}
  }
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1000111;

const ll MOD = 1000000007LL;

void solve() {

}

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

    int a, b;
    cin >> a >> b;

    cout << max({a+b, a-b, a*b});






    return 0;
}


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

int main()
{
    // 整数の入力
    string S;
    cin >> S;
    
    //文字列置換
    if(S[1] == 'R'){
        S[1] = 'B';
    }else{
        S[1] = 'R';
    }

    // 出力
    cout << S << endl;
    
    // cin >> S;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(obj) (obj).begin(),(obj).end()
typedef long long llong;
llong mod=1e9+7;
typedef pair<int,int> P;




int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a.at(i);
  sort(a.begin(),a.end());
  for(int i=1;i<n;i++){
    if(a.at(i)==a.at(i-1)){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
  return 0;
  }


Measured memory_bytes: 1024
n, a = gets.to_s.split.map{|t|t.to_i}
x    = gets.to_s.split.map{|t|t.to_i}

x.map!{|t|t-a}
x.sort!
x.reverse!
# p x
h = Hash.new(0)
h[0] = 1
x.each do |t|
  s = h.dup
  # s = Hash.new(0)
  h.each do |(k,v)|
    next if k+t < 0
    # p h
    s[k+t] += v
    # p [t, k,h[k]] if k + t == 0
  end
  h = s.dup
end

# p h

puts h[0] - 1

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int H, W;
string s[110];
int cnt[26];

int main() {
	cin >> H >> W;

	rep(i, H) {
		cin >> s[i];
		rep(j, W) {
			++cnt[s[i][j]-'a'];
		}
	}

	if (H % 2 == 0 && W % 2 == 0) {
		rep(c, 26) if (cnt[c] % 4 != 0) {
			puts("No");
			return 0;
		}
		puts("Yes");
		return 0;
	} else if (H % 2 == 1 && W % 2 == 1) {
		int odd = 0;

		rep(c, 26) {
			if (cnt[c] & 1) {
				++odd;
				--cnt[c];
			}
		}
		if (odd != 1) {
			puts("No");
			return 0;
		}

		odd = 0;
		rep(c, 26) {
			if (cnt[c] % 4 == 2) {
				++odd;
			}
		}
		int af = W / 2 + H / 2;
		puts(odd <= af ? "Yes" : "No");
		return 0;
	} else {
		int odd = 0;
		rep(c, 26) {
			if (cnt[c] & 1) {
				puts("No");
				return 0;
			}
			if (cnt[c] % 4 == 2) {
				++odd;
			}
		}
		int af = 0;
		if (W % 2 == 0) af += W / 2;
		if (H % 2 == 0) af += H / 2;
		puts(odd <= af ? "Yes" : "No");
		return 0;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

vector<int> fact(10);
int N;

int cnt(vector<int> X) {
  int num = 1;
  for (int i = 0; i < N; i++) {
    int coef = X[i] - 1;
    for (int j = 0; j < i; j++) {
      if (X[j] < X[i]) coef--;
    }
    num += fact[N-i-1] * coef;
  }
  return num;
}

int main() {
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  vector<int> B(N);
  rep(i, N) cin >> B[i];
  fact[1] = 1;
  for (int i = 2; i < N+1; i++) {
    fact[i] = i * fact[i-1];
  }
  int numA = cnt(A);
  int numB = cnt(B);
  int ans = abs(numA - numB);
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<math.h>

using namespace std;

int main(void){
  
  int N,M,X;
  cin >> N >> M >> X;
  X--;
  int A[N];
  fill(&A[0],&A[N],0);
  
  for(int i = 0; i < M; i++){
    int tmp;
    cin >> tmp;
    tmp--;
    A[tmp] = 1; 
  }

  int dist1 = 0;
  int dist2 = 0;
  
  for(int i = 0; i <= X; i++){
    if(A[i])dist1++;
  }
  for(int i = X+1; i < N; i++){
    if(A[i])dist2++;
  }
  
  cout << min(dist1,dist2) << endl;

  return 0;
}


Measured memory_bytes: 256
/*
        FFFFFFFFFFFFFFFFFFFFFF
        F::::::::::::::::::::F
        F::::::::::::::::::::F
        FF::::::FFFFFFFFF::::F
          F:::::F       FFFFFF
          F:::::F
          F::::::FFFFFFFFFF
          F:::::::::::::::F
          F:::::::::::::::F
          F::::::FFFFFFFFFF
          F:::::F
          F:::::F
        FF:::::::FF
        F::::::::FF
        F::::::::FF
        FFFFFFFFFFF
*/
#include <bits/stdc++.h>
using namespace std;
#define debug(...) cout<<__FUNCTION__<<":"<<__LINE__<<": ";debugger(#__VA_ARGS__, __VA_ARGS__);
template<typename arg>
void debugger(const char* varname, arg&& var) { cout<<varname<<" = "<<var<<endl; }
template<typename arg, typename... args>
void debugger(const char* varnames, arg&& var, args&&... vars) {
    const char* comma = strchr(varnames + 1, ',');
    cout.write(varnames, comma - varnames)<<" = "<<var<<" | ";
    int sz = 1; if(isspace(comma[sz])) sz++;
    debugger(comma + sz, vars...);
}
#define forr(i, s, n) for(ll i=(ll)(s); i<(ll)(n); ++i)
#define forn(i, n) forr(i, 0, n)
#define eb(n) emplace_back(n)
#define endl '\n'
#define fst first
#define snd second
using ll = long long;
using ii = pair<ll,ll>;
using vi = vector<ll>;
extern const int INF = INT_MAX - 5;
extern const ll LINF = LLONG_MAX - 5;
extern const int MOD = 1e9 + 7;
extern const int N = 2e5 + 200;
int n;
int v[N];
int main() {
    cin >> n;
    int mx = INF;
    int ans = 0;
    forn(i, n) {
        int d;
        cin >> d;
        if(d < mx) ans++;
        mx = min(mx, d);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a =[]

for i in range(3):
    a .append(list(map(int, input().split())))


n = int(input())
b =[]

for i in range(n):
    b.append(int(input()))



flag = 0
cnt = 0
# yoko
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            cnt += 1
    else:
        if cnt == 3:
            print("Yes")
            flag += 1
            exit()
        else:
            cnt = 0

# tate
if flag == 0:
    for i in range(3):
        for j in range(3):
            if a[j][i] in b:
                cnt += 1

        else:
            if cnt == 3:
                print("Yes")
                flag += 1
                exit()
            else:
                cnt = 0


# ななめ1
if flag == 0:
    for i in range(3):
        if a[i][i] in b:
             cnt += 1
    else:
        if cnt == 3:
            print("Yes")
            flag += 1
            exit()
        else:
            cnt = 0

# ななめ2
if flag == 0:
    if a[2][0] in b:
        if a[1][1] in b:
            if a[0][2] in b:
                print("Yes")
                flag += 1


if flag == 0:
    print("No")


Measured memory_bytes: 62244
csp = 0 
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break

    if csp:
        print()

    csp = 1

    a = (a+3)//4 *4

    lst = [i for i in range(a,b+1,4) if i %100 != 0 or i %400 == 0]

    if lst == []:
        print('NA')

    else:
        for i in lst:
            print(i)


Measured memory_bytes: 5756
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


int a[55], b[55];

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

	int N;
	cin >> N;
	for (int i = 0; i < N; i++)cin >> a[i];
	for (int i = 0; i < N; i++)cin >> b[i];

	int ret = 1e7;
	for (int i = 0; i < (1 << N); i++) {
		vector<pair<int, int>>even;
		vector<pair<int, int>>odd;
		for (int j = 0; j < N; j++) {
			if (i & (1 << j)){
				if (j % 2 == 0)even.pb({a[j],j});
				else odd.pb({a[j],j});
			}
			else {
				if (j % 2 == 0)odd.pb({b[j],j});
				else even.pb({b[j],j});
			}
		}
		if (N % 2 == 0) {
			if (even.size() != odd.size())continue;
		}
		else {
			if (even.size() != odd.size() + 1)continue;
		}
		
		sort(all(even));
		sort(all(odd));
		vector<pair<int,int>>ans(N);
		for (int j = 0; j < even.size(); j++)ans[2 * j] = even[j];
		for (int j = 0; j < odd.size(); j++)ans[2 * j + 1] = odd[j];
		int ok = 1;
		for (int j = 0; j < N - 1; j++)if (ans[j].first > ans[j + 1].first)ok = 0;
		if (!ok)continue;


		int temp = 0;
		for (int k = 0; k < N; k++) {
			for (int l = k + 1; l < N; l++) {
				if (ans[k].second > ans[l].second)temp++;
			}
		}
		ret = min(ret, temp);
	}
	if (ret == 1e7)puts(-1);
	else puts(ret);

	return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
from numba import njit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#@njit
def slove(A):
  count = np.zeros(10**6 + 10, np.int32)
  for x in A:
    if count[x] > 1:
      continue
    count[::x] += 1
  ret = 0
  for x in A:
    ret += count[x] == 1
  return ret

A = np.array(read().split(), np.int32)[1:]

print(slove(A))

Measured memory_bytes: 104740
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,d;
  cin>>n>>d;
  d=2*d+1;
  if(n%d==0){
    n=n/d;
  }
  else{
    n=n/d+1;
  }
  cout<<n;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  ll n,k; cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> b(n,n);
  rep(j,k){
    vector<ll> calc(n,0);
    rep(i,n){
      calc[max(i-a[i],0ll)]++;
      if(i+a[i]+1<n) calc[i+a[i]+1]--;
    }
    rep(i,n){
      if(i-1>=0) calc[i]+=calc[i-1];
    }
    a=calc;
    if(a==b){
      rep(i,n){
        cout << b[i] << " ";
      }cout << endl;
      return 0;
    }
  }
  rep(i,n){
    cout << a[i] << " ";
  }cout << endl;
}

Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
  cin>>n;
  int ans=1;
  int now=0;
  for(int i=1;i<=n;i++){
    int cont=0;
    int nowi=i;
    while(nowi%2==0){
      cont++;
      nowi/=2;
    }
    if(cont>now){
      now=cont;
      ans=i;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
  int x,a,b;
  cin >> x >> a >> b;
  if (a >= b) cout << "delicious" << endl;
  else {
    if (x >= b - a) cout << "safe" << endl;
    else cout << "dangerous" << endl;
  }
}


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

/**
       return NO_PAIN ? NO_GAIN : GAIN;
*/

using namespace std;

#define all(v)   v.begin(), v.end()
#define sz(x)    (int) (x.size())
#define Unique(x) x.erase(unique(all(x)), x.end())
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define pow(n, m) (ll)powl(n, m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define clr(x, val)    memset(x, val, sizeof(x)) //be careful of value and TLE
#define MOD 1000000007
#define EPS 1e-7


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


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin);
    //freopen("test cases\\in.txt", "w", stdout);
    int x, y; cin>>x>>y;
    for(int i = 0; i<=x; i++){
        if(i * 2 + (x - i)*4 == y)
            return cout<<"Yes", 0;
    }
    cout<<"No";
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){//yがいくつ集まったらx以上になるか
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

vector<ll> time10(19,1);
vector<bool> d(10,true);

bool check(ll x){
	ll tmp=x;
	for(int i=4;i>=0;i--){
		if(time10[i]>x) continue;
		if(d[tmp/time10[i]]==false) return false;
		tmp%=time10[i];
	}
	return true;
}

//a,b x
int main(){
	rep1(i,18) time10[i]=10*time10[i-1];
	ll N,K; cin>>N>>K;
	rep(i,K){
		ll tmp; cin>>tmp;
		d[tmp]=false;
	}
	while(1){
		if(check(N)){
			cout<<N;
			return 0;
		}
		N++;
	}
}

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

int main()
{
  string s;
  cin >> s;
  
  int A=0, Z=0;
  bool finish = false;
  
  for (int i=0; i<s.size(); i++) {
    if (s.at(i) == 'A') {
      A = i;
      finish = true;
    }
    if (finish) break;
  }

  for (int i=0; i<s.size(); i++) {
    if (s.at(i) == 'Z') {
      Z = i;
    }
  }
  cout << Z-A+1 << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e6+10;
ll cal(ll n)
{
    ll ans=0;
    while(n)
    {
        ans+=n/5;
        n/=5;
    }
    return ans;
}
int main()
{
    ll n;cin>>n;
    if(n%2)
        cout<<"0"<<endl;
    else
        cout<<cal(n/2)<<endl;
    return 0;
}


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


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

  if(((N-1)*(N-2)/2<K)){
    cout << -1 << endl;
    return 0;
  }

  int max_K = (N-1)*(N-2) / 2;
  int ans = N-1+max_K-K;
  cout << ans << endl;
  for(int ii=2; ii<=N; ii++){
    cout << 1 << " " << ii << endl;
  }
  int count = max_K-K;
  for(int ii=2; ii<N; ii++){
    for(int jj=ii+1; jj<=N; jj++){
      if(count==0){
        return 0;
      }
      cout << ii << " " << jj << endl;
      count--;
    }
  }
  return 0;
}


Measured memory_bytes: 256