akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    ll j = 0;
    rep(i, 9) {
        if("AKIHABARA"[i] == s[j]) {  // AKIHABARAのi文字目とsのj文字目が一致していたら
            j++;  // jを1増やしてsのj+1文字目を調べる
        }
        else if("AKIHABARA"[i] != 'A') {  // AKIHABARAのi文字目とsのj文字目が'A'以外で一致していないならダメ
            out("NO");
            re0;
        }
    }

    if(j == s.size()) {  // sの文字を全て調べていたらok
        out("YES");
    }
    else {  // sの文字を全て調べていなければダメ
        out("NO");
    }
    
    re0;
}

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

int main(void) {
    int n, dn, tmp, ans=0;
    cin >> n;
    for (int i = 1; i <= n; i++ ) {
        string s = to_string(i);
        if (s.length()%2) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::input;
use std::collections::HashMap;

fn main() {
  input! {
    n: usize,
    a: [usize; n],
    q: usize,
    bc: [(usize, usize); q]
  }

  let mut ans:usize = 0;
  let mut map_a = HashMap::new();
  
  for a_i in a {
    let key = map_a.entry(a_i).or_insert(0);
    *key += 1;
    ans += a_i;
  }

  for (b,c) in bc {
    if let Some(&b_num) = map_a.get(&b) {
      *map_a.entry(c).or_insert(0) += b_num;
      *map_a.entry(b).or_insert(0) = 0;

      ans -= b_num * b;
      ans += b_num * c;
    }//bをキーをするものがなければ何もしない

    println!("{}", ans);
  }

  //println!("Hello, AtCoder!");
}


Measured memory_bytes: 9536
/*

  _____      _____     _____    __    __    _______    _____    _____    ______      _______      __
 |  _  \    |  _  \   |_   _|   \ \  / /   |   ____|  |_   _|  |  ___|  (   ___|    |__   __|    /  \
 | |_)  )   | |_)  )    | |      \ \/ /    |  |____     | |    | |__     \  (__        | |      / /\ \
 | ____/    | ____/     | |      / /\ \    |   ____|    | |    |  __|     \__   \      | |     / /__\ \
 | |        | |\ \     _| |_    / /  \ \   |  |        _| |_   | |___     ____)  )     | |    / /----\ \
 |_|        |_| \_\   |_____|  /_/    \_\  |__|       |_____|  |_____|   |______/      |_|   /_/      \_\
*/

#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define M 300005
#define mod 1000000007
#define oo (ll)1e18
#define pii pair<ll,ll>
#define fi first
#define se second
#define debug(x) cout<<" :"<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :"<<x<<"\t"<<#y<<": "<<y<<"\n";
#define f(i,x,y) for(ll i=x;i<y;i++)
#define boost ios::sync_with_stdio(0);cin.tie(0);
#define in_arr0(a,n) f(i,0,n){cin>>a[i];}
#define in_arr1(a,n) f(i,1,n+1){cin>>a[i];}
#define pb(i) push_back(i)
#define mp  (x,y) make_pair(x,y)
ll n,m;
string s,t;
int main(){
  boost;
  cin>>s>>t;
  n = s.size();
  m = t.size();
  ll dp[3002][3002]={0};

  f(i,1,n+1){
    f(j,1,m+1){
      if(s[i-1]==t[j-1]){
        dp[i][j] = max(1+dp[i-1][j-1],dp[i][j]);

      }
      else{
        dp[i][j] =  max(dp[i][j-1],dp[i][j]);
        dp[i][j] =  max(dp[i-1][j],dp[i][j]);
      }
    }
    
  }
  stack<char> p;
  //cout<<dp[n][m];
  int i=n,j=m;
  while(i>0&&j>0){
    if(s[i-1]==t[j-1]){
      p.push(s[i-1]);
      i--;
      j--;
    }
    else{
        if(dp[i][j-1]>dp[i-1][j]){
          j--;
        }
        else {
          i--;
        }
    }
    
  }
  while(p.size()){
    cout<<p.top();
    p.pop();
  }
  return 0;
}


Measured memory_bytes: 70656
abcx=[int(input()) for _ in range(4)]
count=0
for i in range(abcx[0]+1):
  for j in range(abcx[1]+1):
    if abcx[3]-(500*i+100*j)>=0 and (abcx[3]-(500*i+100*j))%50==0 and (abcx[3]-(500*i+100*j))//50<=abcx[2]:
      count+=1
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <sstream>
#include <climits>
#include <fstream>
#include <cmath>

using namespace std;

/// ********* debug template by Bidhan Roy *********

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const unordered_set< T > &v ) {
    os << "[";
    typename unordered_set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const unordered_map< F, S > &v ) {
    os << "[";
    typename unordered_map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << ": " << it -> second ;
    } 
    return os << "]";
}

#define debug(x) cerr << #x << " = " << x << endl;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<bool> VB;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<LL> VLL;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<VB> VVB;
typedef vector<VI> VVI;
typedef vector<VC> VVC;
typedef vector<VLL> VVLL;
typedef vector<VD> VVD;
typedef vector<VS> VVS;

// TEMPLATE DEFINITIONS END

int x, y;

void read_input(){
    cin >> x >> y;
}

void solve(){
    unordered_map<int, int> m = {{3, 100000}, {2, 200000}, {1, 300000}};

    int sol = 0;
    if(m.count(x)) sol += m[x];
    if(m.count(y)) sol += m[y];
    if(x == 1 && y == 1) sol += 400000;

    cout << sol << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    read_input();
    solve();
    return 0;
}


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
a = LI()
print((n-2)//(k-1)+1)


Measured memory_bytes: 52508
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

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

bool swp = false;
int fx = 1, fy = 1;

void print(vector<P>& plist) {

	cout << plist.size() << endl;

	for (int i = 0; i < plist.size(); i++) {
		if (swp) {
			swap(plist[i].first, plist[i].second);
		}
		plist[i].first *= fx;
		plist[i].second *= fy;
		cout << plist[i].first << " " << plist[i].second << endl;

	}
}

int main() {
	ll K, X, Y;
	cin >> K >> X >> Y;
	if (X < 0)X = -X, fx = -1;
	if (Y < 0)Y = -Y, fy = -1;

	if (Y > X)swap(X, Y), swp = true;

	if (K % 2 == 0 & (X + Y) % 2 == 1) {
		cout << -1 << endl;
		return 0;
	}
	
	vector<P> printlist;
	if (X + Y == K) {
		printlist.push_back(P(X, Y));
		print(printlist);
		return 0;
	}

	if ((X + Y) % 2 == 1 && (X + Y) < K) {
		ll p = K - X, q = (K + X - Y) / 2;
		printlist.push_back(P(X, -p));
		printlist.push_back(P(X + q, -p + (K - q)));
		printlist.push_back(P(X, Y));
		print(printlist);
		return 0;
	}

	ll n;
	
	if ((X + Y) % 2 == 0 && K > X + Y) {
		n = 2;
	}
	else {
		n = (X + Y) / K;
		if ((X + Y) % K != 0)n++;
		if ((X + Y) % 2 != (n * K) % 2)n++;
	}

	ll p = (n * K - X - Y) / 2;
	for (int i = 0; i < n; i++) {
		ll dis = (i + 1) * K;
		
		if (dis <= p)printlist.push_back(P(0, -dis));
		else if (dis <= p + X)printlist.push_back(P(dis - p, -p));
		else printlist.push_back(P(X, dis - X - 2 * p));

	}

	print(printlist);

	return 0;
}

Measured memory_bytes: 5484
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,z,w,vis[2001];
    cin>>n>>z>>w;
    for(int i=0;i<n;i++)  cin>>vis[i];
    if(n==1)  cout<<abs(vis[n-1]-w)<<endl;
    else cout<<max(abs(vis[n-1]-vis[n-2]),abs(vis[n-1]-w))<<endl;
    return 0;
}

Measured memory_bytes: 256
N,K,Q=map(int,input().split())

list_seikaisha =[]

for i in range(Q):
    list_seikaisha.append(int(input())-1)

list_pt=[K for i in range(N)]

for seikaisha in list_seikaisha:
    list_pt[seikaisha]=list_pt[seikaisha]+1
list_pt=[x-Q for x in list_pt]

list_YN=[]
f=lambda pt:"Yes" if pt>=1 else "No"
for pt in list_pt:
    print(f(pt))

Measured memory_bytes: 13776
n=int(input())
w=[input() for i in range(n)]
flag=1

for i in range(n-1):
  if w[i][-1]!=w[i+1][0]:
    flag*=0
  else:
    flag*=1

if len(w)!=len(set(w)):
  flag*=0

if flag==0:
  print('No')
else:
  print('Yes')



Measured memory_bytes: 38256
// Shift-JIS（シフトジス）

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

int main()
{
    long long N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    long long c[] = {A, B, C, D, E};
    long long x;
    x = A;
    long long ans;
    for (int i = 0; i < 5; i++) {
        x = min(x, c[i]);
    }
    if (N % x == 0) {
        ans = N / x + 4;
    } else {
        ans = N / x + 5;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())

last = input()
s = set()
s.add(last)

for i in range(1, n):
    word = input()
    if last[len(last) - 1] != word[0] or word in s:
        print("No")
        exit(0)
    else:
        last = word
        s.add(word)
print("Yes")


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
long xxx[10][901][101];

long pattern(int n,int s,int from){
	long i,x=0;
	if(s>100*n)return 0;
	if(xxx[n][s][from]>=0)x=xxx[n][s][from];
	else{
		for(i=(s-100*(n-1)>from?s-100*(n-1):from); i<100 && i*n<=s ;i++){x+=pattern(n-1,s-i,i+1);}
		xxx[n][s][from]=x;
	}
	return x;
}

int main(void){
	int n,s,i,j,k;
	for(j=0;j<101;j++){for(k=0;k<101;k++){xxx[1][j][k]=( (j<=100 && k<=j)?1:0 );}}
	for(i=2;i<10;i++){for(j=0;j<=i*100;j++){for(k=0;k<101;k++){xxx[i][j][k]=-1;}}}
    while(scanf("%d %d",&n,&s)*(n+s)){
	printf("%ld\n",pattern(n,s,0));}
    return 0;
}

Measured memory_bytes: 5844
#include<cstdio>
#include<vector>
#include<queue>
#include<utility>
#include<cstring>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> PP;

vector<int> val[2];

int field[2][550][550];
int cfield[2][550][550];

int X[2],Y[2];
int H[2],W[2];

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

int cango[2][300300];

bool visited[550][550];

int main()
{
	while(1)
	{
	int R;
	scanf("%d",&R);
	if(R==0) break;
	for(int f=0;f<=1;f++)
	{
		val[f].clear();
		scanf("%d%d%d%d",W+f,H+f,X+f,Y+f);
		X[f]--;Y[f]--;
		for(int y=0;y<H[f];y++)
		{
			for(int x=0;x<W[f];x++)
			{
				scanf("%d",&field[f][y][x]);
				val[f].push_back(field[f][y][x]);
			}
		}
		val[f].push_back(0);
		sort(val[f].begin(),val[f].end());
		val[f].erase(unique(val[f].begin(),val[f].end()),val[f].end());
		for(int y=0;y<H[f];y++)
		{
			for(int x=0;x<W[f];x++)
			{
				cfield[f][y][x]=distance(val[f].begin(),lower_bound(val[f].begin(),val[f].end(),field[f][y][x]));
			}
		}
	}
	memset(cango,0,sizeof(cango));
	for(int f=0;f<=1;f++)
	{
		memset(visited,false,sizeof(visited));
		priority_queue<PP,vector<PP>,greater<PP> > que;
		int nowlv=0;
		que.push(PP(1,P(Y[f],X[f])));
		visited[Y[f]][X[f]]=true;
		while(!que.empty())
		{
			PP pp=que.top();
			que.pop();
			int y=pp.second.first,x=pp.second.second;
			if(pp.first<=nowlv)
			{
				cango[f][nowlv]++;
			}
			else
			{
				for(int lvs=nowlv;lvs<=pp.first;lvs++)
				{
					cango[f][lvs]=cango[f][nowlv];
				}
				nowlv=pp.first;
				cango[f][nowlv]++;
			}
			for(int i=0;i<4;i++)
			{
				int ny=y+dy[i],nx=x+dx[i];
				if(ny<0||nx<0||ny>=H[f]||nx>=W[f]) continue;
				if(visited[ny][nx]==true) continue;
				visited[ny][nx]=true;
				que.push(PP(cfield[f][ny][nx],P(ny,nx)));
			}
		}
	}
	/*
	for(int i=0;i<val[0].size();i++)
	{
		printf("%d ",cango[0][i]);
	}
	printf("\n");
	for(int i=0;i<val[1].size();i++)
	{
		printf("%d ",cango[1][i]);
	}
	printf("\n");
	*/
	int ans=1100100100;
	int a1=0,a2=val[1].size()-1;
	while(1)
	{
		if(cango[0][a1]+cango[1][a2]>=R)
		{
			ans=min(ans,val[0][a1]+val[1][a2]);
			if(a2==0) break;
			a2--;
		}
		else
		{
			a1++;
			if(a1==val[0].size()) break;
		}
	}
	printf("%d\n",ans);
	}
	return 0;
}

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

int main(){
  string T;
  cin >> T;
  int N;
  N = T.size();
  for(int i = 0; i < N; i++){
    if(T.at(i) == '?'){
      T.at(i) = 'D';
    }
  }
  cout << T << endl;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

int main(){	
	long long M;
	long long N;
	scanf("%lld",&N);
	vector<long long> X(N-1+1);
	scanf("%lld",&M);
	map<ll, ll> m;
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&X[i]);
		m[X[i]]++;
	}
	map<ll, ll> m1, m2;
	rep(i, 100001) {
		m1[i%M] += m[i]%2;
		m2[i%M] += m[i]-m[i]%2;
	}
	ll res = 0;
	rep(i, M/2+1) {
		// cout << i << ": " << m1[i] << " " << (M-i)%M << ": " << m1[(M-i)%M] << endl;
		// cout << i << ": " << m2[i] << " " << (M-i)%M << ": " << m2[(M-i)%M] << endl;
		if (i != (M-i)%M) {
			ll b1 = min(m1[i],m1[(M-i)%M]);
			// cout << i << ": " << m1[i] << " " << (M-i)%M << ": " << m1[(M-i)%M] << endl;
			// cout << i << ": " << m2[i] << " " << (M-i)%M << ": " << m2[(M-i)%M] << endl;
			res += b1;
			m1[i] -= b1;
			m1[(M-i)%M] -= b1;
		} else {
			ll b1 = m1[i]/2;
			res += b1;
			m1[i] -= b1;
			// cout << i << ": " << m1[i] << " " << (M-i)%M << ": " << m1[(M-i)%M] << endl;
			// cout << i << ": " << m2[i] << " " << (M-i)%M << ": " << m2[(M-i)%M] << endl;
		}
		// cout << i << ": " << m1[i] << " " << (M-i)%M << ": " << m1[(M-i)%M] << endl;
		// cout << i << ": " << m2[i] << " " << (M-i)%M << ": " << m2[(M-i)%M] << endl;
		if (i != (M-i)%M && m1[i] > 0) {
			ll b2 = min(m1[i],m2[(M-i)%M]);
			res += b2;
			m1[i] -= b2;
			m2[(M-i)%M] -= b2;
		}
		if (i != (M-i)%M && m1[(M-i)%M] > 0) {
			ll b2 = min(m1[(M-i)%M],m2[i]);
			res += b2;
			m1[(M-i)%M] -= b2;
			m2[i] -= b2;
		}
		// cout << i << ": " << m1[i] << " " << (M-i)%M << ": " << m1[(M-i)%M] << endl;
		// cout << i << ": " << m2[i] << " " << (M-i)%M << ": " << m2[(M-i)%M] << endl;
	}
	rep(i, M) {
		res += m2[i]/2;
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 19840
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long 
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
 
#define y1 what

using namespace std;
 
const int N = (int) 5e3 + 10;
const int M = (int) 4e6 + 7;
const ll LINF = (ll) 1e18;
const int INF = (int) 1e9 + 7;
const double EPS = (double) 1e-9;
const int mod = 1e9 + 7;

const int nx[4] = {1, -1, 0, 0};
const int ny[4] = {0, 0, 1, -1};

int main() {
    #define fn "balls"
    #ifdef witch
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
//        freopen(fn".in", "r", stdin);
//        freopen(fn".out", "w", stdout);
    #endif
    ll a, b, ans = 0;
    cin >> a >> b;
    a -= b;
    ans += a + b;
    while (b) {
    	ans += b * (2 * (a / b) - (a % b == 0));
    	a %= b;
    	swap(a, b);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
//#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
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 int INF = 2e9;
const ll LINF = (1LL<<60);

vector<pair<char, int>> runLengthEncoding(string &s)
{
  int n = s.size();
  vector<pair<char, int>> res;
  for(int i=0; i<n; i++){
    int cnt = 1;
    while (i < n - 1 && s[i]==s[i+1]){
      cnt++;
      i++;
    }

    res.emplace_back(s[i], cnt);
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  string s(n, '0');
  REP(i,n){
    int a,b; cin >> a >> b;
    if(a==b) s[i] = '1';
  }

  auto rle = runLengthEncoding(s);
  for(auto [c, cnt]: rle){
    if(c=='1' && cnt>=3){
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int s;
  s=S.size();
  int count=0;
  int ans=0;
  for(int i=0;i<s;i++){
    if(S.at(i)=='A'||S.at(i)=='T'||S.at(i)=='G'||S.at(i)=='C'){
      count++;
    }
    else{
      if(ans<count){
      ans=count;
      count=0;
      }
    }
  }
  if(ans<count){
    ans=count;
  }
  cout << ans;
}

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

using namespace std;
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

int main (){
    map<string, int>atc;
    int N,M;
    cin >> N;
    string s[120],t[120];
    cinf(N,s);
    cin >> M;
    cinf(M,t);
    REP(i,N){
      	atc[s[i]];
        atc[s[i]]++;

    }
    REP(i,M){
      atc[t[i]];
       atc[t[i]]--;
    }
    int max = 0;
    for(auto itr = atc.begin(); itr != atc.end(); ++itr){
        if(max < itr->second){
            max = itr->second;
        }
    }
    cout << max << endl;


    return 0;
}

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

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int cnt=0;
    while(cnt<=c){
        b-=a;
        if(b<0){
            cout<<cnt<<endl;
            return 0;
        }
        cnt++;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;
main(){
  int k;
  int N[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  scanf("%d",&k);
  printf("%d",N[k-1]);
}

Measured memory_bytes: 256
void main(){
	int x, a;
	readf("%d %d", &x, &a);
	if(x<a)writeln(0);
	else writeln(10);
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


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

int main() {
    int n;
    cin >> n;
    vector<vector<int>> vec(10,vector<int>(10,0));
    for(int i = 1; i <= n; i++) {
        int b = 1;
        while(i/b >= 10) b *= 10;
      if(i/b == 0 || i%10 == 0) continue;
      vec.at(i/b).at(i%10)++;
    }
    long long ans = 0;
    for(int i = 1; i <= 9; i++) {
        for(int j = 1; j <= 9; j++) {
            int a = vec.at(i).at(j);
            int b = vec.at(j).at(i);
            ans += a*b;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>

const int maxn = 1e5 + 100;

int n, m, k, cnt, a[maxn], b[maxn];

int main() {
	scanf("%d%d", &n, &m);
	cnt = 0;
	for (int i = 0; i < m; ++i) {
		scanf("%d", a + i);
		cnt += (a[i] >> 1);
	}
	if(cnt + (n >> 1) < n - 1) {
		return !puts("Impossible");
	}
	if(n & 1) {
		if(m == 1) {
			printf("%d\n", a[0]);
			printf("%d\n", n + 1 >> 1);
			for (int i = 0; i < (n >> 1); ++i) {
				printf("2 ");
			}
			return !puts("1");
		}
		for (int i = 1; i < m; ++i) {
			if(a[i] & 1) {
				a[0] ^= a[i];
				a[i] ^= a[0];
				a[0] ^= a[i];
				break;
			}
		}
		if(a[0] & 1) {
			for (int i = 0; i < (a[0] - 1 >> 1); ++i) {
				b[k++] = 2;
			}
		}
		else {
			for (int i = 0; i < (a[0] >> 2); ++i) {
				b[k++] = 2;
			}
			b[k++] = 1;
			for (int i = 0; i < (a[0] - 2 >> 2); ++i) {
				b[k++] = 2;
			}
		}
		for (int i = 1; i < m; ++i) {
			b[k++] = a[i];
		}
		b[k++] = 1;
	}
	else {
		if(~a[0] & 1) {
			for (int i = 1; i < m; ++i) {
				if(a[i] & 1) {
					a[i] ^= a[0];
					a[0] ^= a[i];
					a[i] ^= a[0];
				}
			}
		}
		for (int i = 1; i < m - 1; ++i) {
			if(a[i] & 1) {
				a[i] ^= a[m - 1];
				a[m - 1] ^= a[i];
				a[i] ^= a[m - 1];
			}
		}
		if(a[0] & 1) {
			for (int i = 0; i < (a[0] - 1 >> 1); ++i) {
				b[k++] = 2;
			}
		}
		else {
			for (int i = 0; i < (a[0] >> 2); ++i) {
				b[k++] = 2;
			}
			b[k++] = 1;
			for (int i = 0; i < (a[0] - 2 >> 2); ++i) {
				b[k++] = 2;
			}
		}
		for (int i = 1; i < m - 1; ++i) {
			b[k++] = a[i];
		}
		if(m > 1) {
			if(a[m - 1] & 1) {
				for (int i = 0; i <= (a[m - 1] >> 1); ++i) {
					b[k++] = 2;
				}
			}
			else {
				b[k++] = a[m - 1];
				b[k++] = 1;
			}
		}
		else {
			b[k++] = 1;
		}
	}
	for (int i = 0; i < m; ++i) {
		printf("%d%c", a[i], " \n"[i == m - 1]);
	}
	printf("%d\n", k);
	for (int i = 0 ; i < k; ++i) {
		printf("%d%c", b[i], " \n"[i == k - 1]);
	}
	return 0;
}

Measured memory_bytes: 512
while True:
    Size_lis = list(map(int,input().split()))
    if Size_lis == [0,0,0]:
        break
    n = int(input())
    Size_lis.remove(max(Size_lis))
    m_r = (Size_lis[0] / 2) ** 2 + (Size_lis[1] / 2) ** 2

    for i in range(n):
        r = int(input())
        if m_r >= r ** 2:
            print("NA")
        else:
            print("OK")
        

Measured memory_bytes: 7660
/*
 * cpp_filepath
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
void solve();
int main() { solve(); return 0; }


void solve() {
  int n, m;
  cin >> n >> m;
  n *= m;
  if (n%2==0) cout << "Even" << endl;
  else cout << "Odd" << endl;
}


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

int main() {
  int n;
  cin >> n;
  int bl = n - 1;
  vector<int> b(bl);
  
  for(int i = 0; i < bl; i++) {
    cin >> b.at(i);
  } // from 0 to n - 2
  

  int sum = 0;
  int t;
  while(0 < b.size()) {
    t = b.back();
    if(b.size() == bl) {
      sum += t;
    }
    
    b.pop_back();
    
    if(b.size() == 0) {
      sum += t;
    } else {
      sum += min(b.back(), t);
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;
ll app[26];
ll app1[13];
ll app2[13];
int main() {
  int N; cin >> N;
  string S; cin >> S;

  for ( int i = 0; i < N; i++ ) {
    app[S[i]-'a']++;
  }

  for ( int i = 0; i < 13; i++ ) {
    app1[i] = app[i];
  }
  for ( int i = 13; i < 26; i++ ) {
    app2[i-13] = app[i];
  }
  ll cnt1 = 0;
  ll cnt2 = 0;
  for(int bit = 0; bit < (1<<13); bit++) {
    ll sum = 1;
    for(int i = 0; i < 13; i++) {
      if(bit & (1<<i)) {
	sum *= app1[i];
	sum %= 1000000007;      	
      }
    }
    cnt1 += sum;
    cnt1 %= 1000000007;
  }


  for(int bit = 0; bit < (1<<13); bit++) {
    ll sum = 1;
    for(int i = 0; i < 13; i++) {
      if(bit & (1<<i)) {
	sum *= app2[i];
	sum %= 1000000007;      	
      }
    }
    cnt2 += sum;
    cnt2 %= 1000000007;
  }
  ll ans = (cnt1*cnt2);
  ans %= 1000000007;      	

  //  cout << cnt1-1 << endl;
  //  cout << cnt2-1 << endl;
  if ( cnt1 == 0 ) cout << cnt2-1 << endl;
  else if ( cnt2 == 0 ) cout << cnt1-1 << endl;
  else cout << ans-1 << endl;
  return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;


int main(){
  string s;
  cin >> s;
  int n=s.length();
  vector<LL> hs(n+1,0);
  random_device rd;
  LL b=rd()%MOD;
  vector<LL> pw(n+1,1);
  for(int i=1;i<=n;i++) pw[i]=pw[i-1]*b%MOD;

  for(int i=0;i<n;i++){
    hs[i+1]=(hs[i]*b%MOD+(s[i]-'a'))%MOD;
  }
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]) goto next;
  }
  cout << n << endl << 1 << endl;
  return 0;
  next:;
  vector<bool> hr(n+1,true);
  hr[0]=hr[1]=false;
  for(int i=2;i<=n;i++){
    if(hr[i]){
      for(int j=i*2;j<=n;j+=i){
        hr[j]=false;
      }
    }
  }
  vector<int> p;
  for(int i=2;i<=n;i++){
    if(hr[i]) p.push_back(i);
  }
  int ans=0,x;
  vector<bool> ok(n+1,true);
  ok[0]=ok[n]=false;
  bool okflag;
  for(int i=0;i<p.size();i++){
    if(n%p[i]==0){
      x=n/p[i];
      for(int j=1;j<p[i];j++){
        if((hs[(j+1)*x]-hs[j*x]*pw[x]%MOD+MOD)%MOD!=hs[x]) goto next2;
      }
      cout << 2 << endl;
      for(int j=1;j<=n/2;j++){
        LL hs0=hs[j];
        for(int k=1;k<n/j;k++){
          if((hs[(k+1)*j]-hs[k*j]*pw[j]%MOD+MOD)%MOD!=hs0) break;
          ok[(k+1)*j]=false;
        }
      }
      for(int j=1;j<=n/2;j++){
        LL hs0=(hs[n]-hs[n-j]*pw[j]%MOD+MOD)%MOD;
        for(int k=1;k<n/j;k++){
          if((hs[n-k*j]-hs[n-(k+1)*j]*pw[j]%MOD+MOD)%MOD!=hs0) break;
          ok[n-(k+1)*j]=false;
        }
      }
      for(int j=0;j<=n;j++) if(ok[j]) ans++;
      cout << ans << endl;
      return 0;
      next2:;
    }
  }
  cout << 1 << endl << 1 << endl;
  return 0;
}


Measured memory_bytes: 9092
// Problem : D - Alter Altar
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=a;i>=b;i--)
//vector
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define pp pop_back
//pair
#define pi pair<int ,int >
#define mk make_pair
#define ff first
#define ss second
//set
#define si set<int>
#define sit set<int>::iterator 
using namespace std;
int main()
{
fast;
int n;cin>>n;
string s;cin>>s;
int i=0,j=n-1,cnt=0;
while(i<j)
{
	if(s[i]=='R') i++;
	if(s[j]=='W') j--;
	
	if(s[i]=='W' && s[j]=='R')
	{
		cnt++;
		swap(s[i],s[j]);
		i++;
		j--;
	}
}
cout<<cnt;
return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  bool A[27];
  for (int i = 0; i < 27; i++) {
    A[i] = false;
  }
  for (int i = 0; i < S.size(); i++) {
    A[S[i] - 'a']++;
  }
  for (int i = 0; i < 27; i++) {
    if (i == 26) {
      cout << "None" << endl;
      break;
    }
    if (!A[i]) {
      cout << (char)(i + 'a') << endl;
      break;
    }
    
  }
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
const long long INF = INT64_MAX;

#define REP(i, n) for(ll i=0;i<n;i++)
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).rbegin(), (v).rend())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define DESC(v) sort((v).rbegin(), (v).rend())
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);erase(unique(v.begin(), v.end()), v.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);

void solve() {
    ll N;
    cin >> N;
    vll A(N);
    for(auto &a:A) cin >> a;
    vpll vp;
    for(int i = 0; i < N; i++) {
        vp.push_back(make_pair(A[i], i));
    }
    ASC(vp);
    vll ans(N);
    for(int i = 0; i < N; i++) {
        ll idx = vp[i].second;
        ans[idx] = vp[N/2 - (i >= (N / 2) ? 1 : 0)].first;
    }
    for(auto &a:ans) {
        cout << a << endl;
    }
}

int main() {
    FIO;
    solve();
    return 0;
}


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

int main(){
    int n,w;
    cin>>n>>w;
    vector<int> W(n),V(n);
    for(int i=0; i<n; ++i) cin>>W[i]>>V[i];
    vector<long long > Dp(w+1,0);
    for(int i=0; i<n; ++i){
        vector<long long> Dp_new(w+1,0);
        for(int j=1; j<=w; ++j){
            if(j>=W[i]) Dp_new[j]=max(Dp[j], Dp[j-W[i]]+V[i]);
            else Dp_new[j]=Dp[j];
        }
        Dp=Dp_new;
    }
    cout<<Dp[w]<<"\n";
}

Measured memory_bytes: 4796
#include<stdio.h>
int main()
{
	int a[100],n,i,j,temp,k;
	//scanf("%d",&n);
	for(k=0;k<10;k++)
		scanf("%d",&a[k]);
		for(i=0;i<10;i++)
			for(j=i+1;j<10;j++)
			{
				if(a[i]<a[j])
				{
					temp=a[i];
					a[i]=a[j];
					a[j]=temp;
				}
			}
				printf("%d\n",a[0]);
				printf("%d\n",a[1]);
				printf("%d\n",a[2]);
	return 0;
}

	

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
  long int w,a,b;
  scanf("%ld%ld%ld",&w,&a,&b);
  if((a+w)>=b && b>=a)
      printf("0");
  
  else if(b+w>=a && a>=b)
      printf("0");
  else
  {
  int ans1=abs(b-(a+w));
  int ans2=abs(a-(b+w));
    printf("%d",min(ans1,ans2));
  }
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int n,b,c,d,e,f,g;
  int cards[4][13]={0};

  char a;
  scanf("%d",&n);
  for(c=0;n>0;n--){
    scanf(" %c %d",&a,&b);
    if(a=='S'){
      f=0;
    }
    else if(a=='H'){
      f=1;
    }
    else if(a=='C'){
      f=2;
    }
    else if(a=='D'){
      f=3;
    }
    g=b-1;
    cards[f][g]=1;
  }
  for(d=0;d<4;d++){
    for(e=0;e<13;e++){
      if(cards[d][e]!=1 && d==0){
	printf("S %d\n",e+1);
      }
      else if(cards[d][e]!=1 && d==1){
	printf("H %d\n",e+1);
      }
      else if(cards[d][e]!=1 && d==2){
	printf("C %d\n",e+1);
      }
      else if(cards[d][e]!=1 && d==3){
	printf("D %d\n",e+1);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long X, Y, A, B, C;
	cin >> X >> Y >> A >> B >> C;
	vector<long long>P(A), Q(B), R(C);
	for (long long i = 0; i < A; i++) {
		cin >> P.at(i);
	}
	for (long long i = 0; i < B; i++) {
		cin >> Q.at(i);
	}
	for (long long i = 0; i < C; i++) {
		cin >> R.at(i);
	}
	sort(P.begin(), P.end(), greater<long long>());
	sort(Q.begin(), Q.end(), greater<long long>());
	sort(R.begin(), R.end(), greater<long long>());
	priority_queue<long long>Kari;
	for (long long i = 0; i < X; i++) {
		Kari.push(P.at(i));
	}
	for (long long i = 0; i < Y; i++) {
		Kari.push(Q.at(i));
	}
	long long sum = 0;
	priority_queue<long long, vector<long long>, greater<long long> >Apple;
	for (long long i = 0; i < X + Y; i++) {
		sum += Kari.top();
		long long num = Kari.top(); Kari.pop();
		Apple.push(num);
	}
	for (long long i = 0; i < C; i++) {
		if (Apple.top() >= R.at(i)) {
			cout << sum << endl;
			return 0;
		}
		else {
			sum += abs(R.at(i) - Apple.top());
            long long num = Apple.top(); Apple.pop();
			num = R.at(i);
            Apple.push(num);
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 7664
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define _USE_MATH_DEFINES
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const int MOD=1000000007;
const double EPS=1e-9;

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


int main()
{
    int H, W, A, B;
    cin >> H >> W >> A >> B;

    rep(i,B) {
        rep(i,A) cout << 0;
        rep(i,W-A) cout << 1;
        cout << endl;
    }
    rep(i,H-B) {
        rep(i,A) cout << 1;
        rep(i,W-A) cout << 0;
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 1280
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
bool Sort(long long a, long long b)
{
	return a > b;
}
int main()
{
	int num;
	while (cin >> num)
	{
		vector<long long> arr(num);
		for (int i = 0; i < num; i++)
			cin >> arr[i];
		sort(arr.begin(), arr.end(), Sort);

		long long a = 0, b = 0, temp = arr[0];
		for (int i = 1; i < num; i++)
		{
			if (temp == arr[i])
			{
				if (a < arr[i])
				{
					a = arr[i];
				}
				else if (b < arr[i])
				{
					b = arr[i];
				}
				temp = -1;
			}
			else temp = arr[i];
		}
		cout << a*b << endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a) for(int i=0;i<a;i++)

//int型を受け取ってその桁数を返す
int check_digits(int n, int m) {
	int digits = 0;
	while (n != 0) {
		n /= m;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum = 0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}


//入力された文字列が回文か判断してboolを返す
bool is_kaibun(string s) {
	string s_r(s.rbegin(), s.rend());
	return (s == s_r);
}


void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }


//提出言語もしっかり確認して…
//問題文を落ち着いて読む！
//型に注意！！
//出力例もちゃんと全部見る！！！！！
int main() {
	int n;
	cin >> n;
	vector<double> v(n);
	rep(i, n)cin >> v[i];

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

	double ans = v[0];
	for (int i = 1; i < n;i++) {
		ans = (ans + v[i]) / 2.0;
	}

	cout << ans << endl;
	system("pause");
	return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

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

  if (s.size() == 2) {
    if (s[0] == s[1]) {
      cout << "1 2" << endl;
    } else {
      cout << "-1 -1" << endl;
    }
    return 0;
  }
  for (int i = 0; i + 3 <= (int)s.size(); i++) {
    if (s[i] == s[i+1] || s[i] == s[i+2] || s[i+1] == s[i+2]) {
      cout << i+1 << " " << (i+3) << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string S;
    cin >> S;

    int W = 0, B = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'B') {
            B++;
        } else if (S[i] == 'W') {
            W += B;
        }
    }

    std::cout << W << std::endl;

    return 0;
}


Measured memory_bytes: 720
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 1001001001
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int main(){
    int n; cin >> n;
    map<string, int> mp;
    rep(i,n){
        string s; cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
       
    }
    ll ans = 0;
    for(auto& p : mp){
        int s = p.second;
        ans += (ll)s*(s-1)/2;
    }
    cout << ans << endl;
    return 0;
    

}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main () {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  
  if (n <= 2) {
    cout << 1 << endl;
    return 0;
  }
  int ct = 0;
  int dir = 0;
  for(int i = 1; i < n; ++i) {
    if (v[i] > v[i - 1]) {
      if (dir < 0) {
        ct++;
        dir = 0;
      } else dir = 1;
    } else if (v[i] < v[i - 1]){
      if (dir > 0) {
        ct++;
        dir = 0;
      } else dir = -1;
    }
  }
 
  ct++;
  cout << ct << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n,a[20],ans=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i];
	rep2(i,1,n-1) if((a[i]>a[i-1]&&a[i]<a[i+1])||(a[i]<a[i-1]&&a[i]>a[i+1])) ans++;
	print1(ans);
	return 0;
}


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

void solve(long long K, long long A, long long B) {
    for (long long i = A; i <= B; i++) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return;
        }
    }
    cout << "NG" << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can
// remove this line by using your custom template)
int main() {
    long long K;
    scanf("%lld", &K);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(K, A, B);
    return 0;
}


Measured memory_bytes: 3764
chomp(my $s = <>);
my ($A, $B) = split(/\s/, $s);
my $x;
if ($A <= 5) {
    $x = 0;
} elsif ($A <= 12) {
    $x = $B / 2;
} else {
    $x = $B;
}
print($x, "\n");


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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    int calculo1, calculo2, resp;
    int tam;
    vector<int> vect;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        vect.emplace_back(x);
    }
    sort(vect.begin(), vect.end());
    tam = vect.size();
    calculo1 = vect[tam / 2];
    calculo2 = vect[(tam / 2) - 1];
    resp = calculo1 - calculo2;
    cout << resp << endl;
    return 0;
}

Measured memory_bytes: 892
import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
   # file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    # max=0
    # max_x=0
    # first=0
    #
    # for x in range(N+1):
    #     rem = x%B
    #     if x == 0:
    #         first=rem
    #     elif rem == first:
    #         break
    #     if rem > max:
    #         max=rem
    #         max_x=x

    if N<B:
        max_x=N
    else:
        max_x=B-1

    # min,_=math.modf(max_x/B)

    print(int(A*max_x/B)-A*int(max_x/B))

if __name__ == '__main__':
    main()


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

int main()
{
    int N;
    cin>>N;
    vector<int> p(N);
    vector<int> n(N);
    for(int i=0;i<N;i++){
        cin>>p.at(i);
        n.at(i)=i+1;

    }
    if(p==n){
        cout<<"YES"<<endl;
        exit(0);
        }

    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            swap(p.at(i),p.at(j));
            if(p==n){
                cout<<"YES"<<endl;
                exit(0);
            }
            swap(p.at(i),p.at(j));
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, m;
    cin >> n >> m;

    int mini = 1;
    int maxi = n;
    rep(i, m){
        int l, r;
        cin >> l >> r;
        mini = max(mini, l);
        maxi = min(maxi, r);
    }

    if(maxi < mini){
        cout << 0 << endl;
        return 0;
    }
    cout << maxi - mini + 1 << endl;

    return 0;
}


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

using namespace std;

int main()
{
    long long int a,b,c;
    cin>>a;
    if(a>=500)
    {
        b=(a/500)*1000;
        a=a%500;
        b=b+(a/5)*5;
    }
    else
    {
        b=(a/5)*5;
    }
    cout<<b<<endl;
    return 0;
}


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

int main(){
    int A, B, C, N, M ,K;
    int sum = 0;
    int t = 0;
    char s, s1;
    cin >> s;

    if(s == 'A') cout << "T" << endl;
    else if(s == 'T') cout << "A" << endl;
    else if(s == 'C') cout << "G" << endl;
    else  cout << "C" << endl;

//    vector<int> X();

//    for(int i = 0; i < ; i++){}
//    for(int j = 0; j < ; j++){}

//    cout <<  << endl;
}

Measured memory_bytes: 256