akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
// include <ext/pb_ds/assoc_container.hpp>
// include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
#define ll long long
// typedef tree <ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define Q queue<ll>
#define DQ deque<ll>
#define P_Q priority_queue<ll>
#define p_q priority_queue<ll,vi,greater<ll>>
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define loop(x,y,z) for(ll i=x; i<=y; i+=z)
#define rloop(x,y,z) for(ll i=x; i>=y; i-=z)
#define all(x) x.begin(), x.end()
#define sum(x) accumulate(all(x),0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define display(v,c) for(auto x:v) cout<<x<<c;
#define endl "\n"
#define watch(x) cout<<(#x)<<" is "<<x<<endl;

ll gcd(ll a, ll b){
	return (!b)?a:gcd(b,a%b);
}

string str;

void computeLPSArray(string pat, ll M, vector<ll> &lps) 
{ 
    // length of the previous longest prefix suffix 
    ll len = 0; 
  
    lps[0] = 0; // lps[0] is always 0 
  
    // the loop calculates lps[i] for i = 1 to M-1 
    ll i = 1; 
    while (i < M) { 
        if (pat[i] == pat[len]) { 
            len++; 
            lps[i] = len; 
            i++; 
        } 
        else // (pat[i] != pat[len]) 
        { 
            // This is tricky. Consider the example. 
            // AAACAAAA and i = 7. The idea is similar 
            // to search step. 
            if (len != 0) { 
                len = lps[len - 1]; 
  
                // Also, note that we do not increment 
                // i here 
            } 
            else // if (len == 0) 
            { 
                lps[i] = 0; 
                i++; 
            } 
        } 
    } 
}


bool isSubstring(string pat,string txt){
	ll M = pat.size(); 
    ll N = txt.size(); 
    vi lps(M,0); 
  
    // Preprocess the pattern (calculate lps[] array) 
    computeLPSArray(pat, M, lps); 
  
    ll i = 0; // index for txt[] 
    ll j = 0; // index for pat[] 
    while (i < N) { 
        if (pat[j] == txt[i]) { 
            j++; 
            i++; 
        } 
  
        if (j == M) { 
            return true;
            j = lps[j - 1]; 
        } 
  
        // mismatch after j matches 
        else if (i < N && pat[j] != txt[i]) { 
            // Do not match lps[0..lps[j-1]] characters, 
            // they will match anyway 
            if (j != 0) 
                j = lps[j - 1]; 
            else
                i = i + 1; 
        } 
    }
    return false;
}

bool check(ll mid){
	loop(0,str.size()-(2*mid),1){
		string temp=str.substr(i,mid);
		if (isSubstring(temp,str.substr(i+mid))) return true;
	}
	return false;
}

int main(){
	IOS
	ll n;
	cin>>n;
	cin>>str;
	ll low=0,high=n/2;
	ll mid;
	while(low<high){
		mid=(low+high+1)/2;
		if(check(mid)) low=mid;
		else high=mid-1;
	}
	cout<<low;
	return 0;
}


Measured memory_bytes: 384
kaisu = gets.to_i

kaisu.times{|i|
    data = gets.split(nil)
    3.times{|j|
      data[j]=data[j].to_i
    }
    data.sort!
    leftSide = data[2].to_i**2
    rightSide = data[1].to_i**2 + data[0].to_i**2
    #puts "L:", leftSide
    #puts "R:", rightSide
    if leftSide == rightSide
      puts "YES"
    else
      puts "NO"
    end
}

Measured memory_bytes: 2480
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, k;
int dis[2005][2005];
vector<int> G[2005];
bool vis[2005];
int over[2005];
void dfs(int root, int now, int prev, int d)
{
	dis[root][now] = d;
	for (int i = 0; i < G[now].size(); i++)
	{
		int v = G[now][i];
		if (prev == v) continue;
		dfs(root, v, now, d + 1);
	}
}
signed main()
{
	cin >> n >> k;
	for (int i = 0; i < n-1; i++)
	{
		int u, v;
		cin >> u >> v;
		u--;v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for (int i = 0; i < n; i++)
		dfs(i, i, -1, 0);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			if (dis[i][j] > k)
				over[i]++;
	int ret = 0;
	while(1)
	{
		int maxn = -1,maxnum = 0;
		for (int i = 0; i < n; i++)
		{
			if (vis[i]) continue;
			if (G[i].size() >= 2) continue;
			if (over[i] > maxnum)
			{
				maxnum = over[i];
				maxn = i;
			}
		}
		if (maxn == -1) break;
		ret++;
		for (int i = 0; i < n; i++)
		{
			if (dis[i][maxn] > k)
				over[i]--;
			if (dis[i][maxn] == 1)
				G[i].pop_back();
		}
		vis[maxn] = true;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 31872
N, M, X = list((map(int, input().split())))
M_list = list((map(int, input().split()))) 


counter = 0
for i in range(M):
	if X < M_list[i]:
		break
	counter += 1

if counter <= M - counter:
	print(counter)
else:
	print(M-counter)

Measured memory_bytes: 3060
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    Left = [set() for _ in range(N)]
    Right = [set() for _ in range(N)]
    Left[0] |= {S[0]}
    Right[N-1] |= {S[N-1]}
    for i in range(1, N):
        Left[i] = Left[i-1] | {S[i]}
        Right[N-i-1] = Right[N-i] | {S[N-i-1]}
    used = set()
    for i in range(1, N - 1):
        mid = S[i]
        for l in Left[i-1]:
            for r in Right[i+1]:
                used |= {l + mid + r}
    print(len(used))

    return 0

if __name__ == "__main__":
    solve()

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int>p(n);
  rep(i,n){
    cin >> p[i];
  }
  rep(i,n-1){
    for(int j=i+1; j<n;j++){
      if(p[i]>p[j]){
        int tep =p[i];
        p[i]=p[j];
        p[j]=tep;
      }
    }
  }
  int m=0;
  
  rep(i,k){
    m+=p[i];
  }
  cout << m << endl;

}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)

int main(){
  int N;
  cin >> N;
  vector<int> a(N), x(N);
  rep(i,N){
    cin >> a.at(i);
    x.at(i) = a.at(i)-i-1;
  }
  sort(x.begin(),x.end());
  int b = x.at(N/2);
  long long ans = 0;
  rep(i,N){
    ans += abs(x.at(i)-b);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 4804
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    string S, T;
    cin >> S;
    T = S;
    if (S.size() < 26){
        set<char> A;
        for (int i = 0; i < S.size(); i++) {
            A.insert(S.at(i));
        }
        cout << S;
        for (int i = 0; i < 26; i++) {
            if (!A.count('a' + i)){
                cout << char('a' + i) << endl;
                return 0;
            }
        }
    }
    if (S == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
    }
    else {
        next_permutation(ALL(S));
        for (int i = 0; i < S.size(); i++) {
            if (S.at(i) == T.at(i)) {
                cout << S.at(i);
            }
            else {
                cout << S.at(i) << endl;
                return 0;
            }
        }
    }
}



Measured memory_bytes: 256
H, W = map(int, input().split())
board = [input() for i in range(H)]
row, col = [], []
for i in range(H):
    c = sum(board[i][j] == '.' for j in range(W))
    row.append(c != W)
for j in range(W):
    c = sum(board[i][j] == '.' for i in range(H))
    col.append(c != H)
for i in range(H):
    for j in range(W):
        if row[i] and col[j]: print(board[i][j], end='')
    if row[i]: print()
        


Measured memory_bytes: 4468
#include<stdio.h>
int main(){
 int a,b,max;
 scanf("%d %d",&a,&b);
max=a;
if(max<b){
 max=b;
 printf("a < b\n");
}else if(max==b){
 printf("a == b\n");
  }else{
printf("a > b\n");
  }
return 0;
}

Measured memory_bytes: 1812
#include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

// using matrix	?????????????????´??????
void func()
{
	double a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()){


		cout << fixed << setprecision(3);


		if ((a*e - d*b) == 0)
			x = 0.0, y = 0.0;
		else {
			x = ((e*c - b*f) / (a*e - d*b));
			y = ((-(d*c) + a*f) / (a*e - d*b));


			if (x == 0)
				x = 0.0;
			if (y == 0)
				y = 0.0;
		}
		cout << x << space << y << endl;


		cout << dec;
	}
}

Measured memory_bytes: 1284
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N, X;
  ll ans = 1000000000000000000;
  std::cin >> N >> X;
  std::vector<int> A(N);
  vvi dp = vv(N, N, 0, int);
  for(int i=0;i<N;i++) std::cin >> A[i];
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      dp[i][j] = (j==0?A[i]:min(dp[i][j-1], A[(N+(i-j))%N]));
    }
  }
  for(int i=0;i<N;i++) {
    ll reg = 0;
    for(int j=0;j<N;j++) reg += dp[j][i];
    ans = min(ans, reg + i * X);
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 16000
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    int N;
    cin >> N;
    string w[N];
    for (int i = 0; i < N; i++) {
        cin >> w[i];
    }
    bool flag = true;
    for (int i = 1; i < N; i++) {
        if (w[i - 1][w[i - 1].length() - 1] != w[i][0]) flag = false;
        for (int j = 0; j < i; j++) {
            if (w[i] == w[j]) flag = false;
        }
    }
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import string

S = list(input())
K = int(input())

alpha = string.ascii_lowercase
s = len(S)

for i in range(s):
    num = (26 - alpha.index(S[i])) % 26
    if num <= K:
        K -= num
        S[i] = 'a'
    else:
        pass

if K > 0:
    num = (alpha.index(S[-1]) + K) % 26
    S[-1] = alpha[num]
else:
    pass

print(*S, sep='')

Measured memory_bytes: 7484
n=int(input())
v=list(map(int,input().split()))
from collections import defaultdict
a=defaultdict(int)
b=defaultdict(int)
for i in range(n):
  if i%2==0:
    a[v[i]]+=1
  else:
    b[v[i]]+=1

am=max(a.values())
bm=max(b.values())
if max(a,key=a.get) !=max(b,key=b.get):
  print(n-am-bm)
else:
  b[max(b, key=b.get)]=0
  a[max(a, key=a.get)]=0
  a2=n-am-max(b.values())
  b2=n-bm-max(a.values())
         
  print(min(a2,b2))

 
  

Measured memory_bytes: 21940
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
int n,m;
struct Mat
{
	int a[4][4];
	int*operator[](int i){return a[i];}
	Mat(){memset(a,0,sizeof(a));}
	inline void idx(){for(int i=1;i<=3;i++)a[i][i]=1;}
}A,B,Ans;
inline int read()
{
    char c=getchar();int res=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')res=res*10+c-'0',c=getchar();
    return res*f;
}
Mat operator*(Mat a,Mat b)
{
	Mat c;
	for(int i=1;i<=3;i++)
		for(int j=1;j<=3;j++)
			for(int k=1;k<=3;k++)
				c[i][j]=(c[i][j]+a[i][k]*b[k][j]%mod)%mod;
	return c;
}
inline Mat calc(Mat a,Mat b,int k)
{
	while(k)
	{
		if(k&1)a=a*b;
		b=b*b;k>>=1;
	}
	return a;
 } 
signed main()
{
	n=read(),m=read();
	A[1][1]=1,A[2][1]=1,A[2][2]=1,A[3][1]=1,A[3][2]=2,A[3][3]=1;
	B=A;
	for(int i=1;i<=3;i++)B[i][3]++;
	Ans[1][3]=1;
	int x=0,pre=1;
	for(int i=1;i<=m;i++)
	{
		x=read();
		Ans=calc(Ans,B,x-pre);
		Ans=Ans*A;
		pre=x+1;
	}
	Ans=calc(Ans,B,n-pre);
	printf("%lld",(Ans[1][1]+Ans[1][2]+Ans[1][3])%mod);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll a,b,c,d;
  cin  >> a >> b >> c >> d;
  if((a<=0 && b>=0) || (c<=0 && d>=0)){
    ll x=max(a*d,max(b*c,a*c));
    cout << max(x,max(b*d,(ll)0)) << endl;;
  }
  else{
    ll x=max(a*d,max(b*c,a*c));
    cout << max(x,b*d) << endl;
  }
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*約数の個数(x含む)*/ll divi(ll x){ll i,ans=0;rep(i,2,x+1){if(x%i==0){ans++;}}return ans;}
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;ll ans=0;////////////////////////////////////////////////////////////
int main(){
 char k,n;
 sc(n);
 if('Z'-n>=0)puts("A");
 else puts("a");
return 0;}

Measured memory_bytes: 3616
/*
                                               
 ____                 ______           _____   
|    |            ___|\     \      ___|\    \  
|    |           |    |\     \    |    |\    \ 
|    |           |    |/____/|    |    | |    |
|    |        ___|    \|   | |    |    |/____/|
|    |       |    \    \___|/     |    ||    ||
|    |       |    |\     \        |    ||____|/
|____|  ___  |\ ___\|_____|  ___  |____|       
|    | |   | | |    |     | |   | |    |       
|____| |___|  \|____|_____| |___| |____|       
  \(             \(    )/           \(         
   '              '    '             '      
   				template v.1.4   
                                           
*/
#include <bits/stdc++.h>

#define fi first
#define se second
#define pb push_back
#define sz(s) (int)s.size()
#define OPTIMIZE ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(x) cerr << "#" << x << ": " << x << '\n';
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define FORD(i, a, b) for (int i = b; i >= a; i--)
#define FORL(i, a, b) for (LL i = a; i <= b; i++)
#define FORDL(i, a, b) for (LL i = b; i >= a; i--)

using namespace std;

typedef long long LL;
typedef pair<int,int> ii;
typedef pair<LL,LL> pll;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<ii> vii;
typedef vector<pll> vll;

const LL MODPRIME = 1e9 + 7;
const double EPS  = 1e-12;
const LL MAXL = 4e18;
const LL MINL = -4e18;
const int MAXI = 2e9;
const int MINI = -2e9;

int N, A, B, a, b, c;
int arr[105];

int main(){
	// #ifndef ONLINE_JUDGE
	// 	freopen("in.txt", "r", stdin);
	// #endif
	OPTIMIZE
	cin >> N >> A >> B;
	for (int i = 0; i < N; i++) cin >> arr[i];
	sort(arr, arr + N);
	for (int i = 0; i < N; i++){
		if (arr[i] <= A) a++;
		else if (arr[i] > A && arr[i] <= B) b++;
		else if (arr[i] > B) c++;
	}
	cout << min(min(a, b), c) << '\n';
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [None] * M
K = [None] * M
for i in range(M):
    a, b = map(int, input().split())
    C = map(int, input().split())
    A[i] = a
    K[i] = sum([2 ** (i - 1) for i in C])


INF = (1 << 32) - 1
dp = [[INF] * (2 ** N) for _ in range(M + 1)]
for i in range(M + 1):
    dp[i][0] = 0

for i in range(M):
    k = K[i]
    a = A[i]
    for j in range(2 ** N):
        here = dp[i][j]
        dp[i + 1][j] = min(dp[i + 1][j], here)
        dp[i + 1][j | k] = min(dp[i + 1][j | k], dp[i][j | k], here + a)

ans = dp[M][2 ** N - 1] if dp[M][2 ** N - 1] < INF else -1
print(ans)


Measured memory_bytes: 78696
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n = read(&mut stdin_lock, &mut buf, b' ');
    let i = read(&mut stdin_lock, &mut buf, b'\n');
    println!("{}", solve(n, i));
}

fn solve(n: u8, i: u8) -> u8 {
    n - i + 1
}

#[test]
fn example1() {
    assert_eq!(3, solve(4, 2))
}

#[test]
fn example2() {
    assert_eq!(1, solve(1, 1))
}

#[test]
fn example3() {
    assert_eq!(5, solve(15, 11))
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string alp = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> ll gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(ll H, ll W, ll h, ll w){return 0 <= h && h < H && 0 <= w && w < W;}

int main(){
    string T; cin >> T;
    ll N = T.size();
    rep(i, N){
        if(T[i] == '?'){
            T[i] = 'D';
        }
    }
    pt(T);
}


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

int n,k,d[12];
bool abandoned[10];

int main() {

    while(cin>>n>>k) {

        memset(abandoned,0,sizeof(abandoned));

        for(int i=0; i<k; i++) {
            scanf("%d",d+i);
            abandoned[d[i]]=1;
        }

//        for(int i=0;i<10;i++)
//            printf("abandoned %d\n",abandoned[i]);

        bool ok=0;

        while(1) {

            int temp=n;
            bool allok=1;

//           cout<<n<<endl;

            while(temp) {


//              printf("%d",temp%10);


                if(abandoned[temp%10]) {
                    allok=0;
                    break;
                }
                temp/=10;
            }

//           if(n==20720)
//            printf("\n");

            if(allok) {
                break;
            }

            n++;
        }

        cout<<n<<endl;



    }


    return 0;
}

/*
20714 3
4 7 3

29714 4
4 7 3 9

*/


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_D
{
    class D059
    {
        static HashSet<string> lose = new HashSet<string>();
        static HashSet<string> win = new HashSet<string>();
        static void Main(string[] args)
        {
            long[] h = Console.ReadLine().Split(' ').Select(z => long.Parse(z)).ToArray();
            long X = h[0], Y = h[1];

            string w = "Alice";
            if (Math.Abs(X - Y) <= 1 ) w = "Brown";
            Console.WriteLine(w);


            //if (Y > X)
            //{
            //    long z = X;X = Y;Y = z;
            //}
            //string winner = IsWin(X, Y) ? "Alice" : "Brown";
            //Console.WriteLine(winner);
        }

        //x>=y 
        static bool IsWin(long x, long y)
        {
            if (x <= 1 && y <= 1) return false;
            string pair = x + "-" + y;
            if (lose.Contains(pair)) return false;
            else if (win.Contains(pair)) return true;

            long i = x / 2;
            while (i > 0)
            {
                long x1 = x - 2 * i; long y1 = y + i;
                if (y1 > x1)
                {
                    long z = x1; x1 = y1; y1 = z;
                }
                if(!IsWin(x1, y1))
                {
                    win.Add(pair);
                    return true;
                }
                i--;
            }

            long j = y / 2;
            while (j > 0)
            {
                long x1 = x+ j; long y1 = y - 2 * j;
                if (y1 > x1)
                {
                    long z = x1; x1 = y1; y1 = z;
                }
                if (!IsWin(x1, y1))
                {
                    win.Add(pair);
                    return true;
                }
                j--;
            }

            lose.Add(pair);
            return false;
        }

    }
}


Measured memory_bytes: 13408
n,m = map(int,input().split())

#上端・下端　(n-2)*2枚のカードは、必ず裏
#４隅　4枚のカードは、必ず裏
#左端・右端　(m-2)*2枚のカードは、必ず裏
#これらの条件が強い

#中央 (n-2)*(m-2)枚のカードは、表

#1行か1列のときは、両端が裏、内側が表

if n == 1 and m == 1:
	ans = 1
elif n == 1:
	ans = m-2
elif m == 1:
	ans = n-2
else:
	ans = (n-2)*(m-2)

print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll a[52],dp[52];
int main() {
	ll n,p;
	cin>>n>>p;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
	}
	ll cnt=1;
	if(p==0){
		dp[0]=1;
	}
	for(ll i=1;i<=n;i++){
		ll now=a[i];
		if(a[i]%2==0){
			dp[i]=2*dp[i-1];
		}
		else{
			dp[i]=dp[i-1]+cnt-dp[i-1];
		}
		cnt*=2;
	}
	cout << dp[n];
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
	double r;
	cin >> r;
	double pi = acos(-1);
	printf("%.6f %.6f\n", r * r * pi, r * 2 * pi);
	getchar();
	getchar();
	return 0;
}


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

int main() {
  int a,b,c,d ;
  cin >> a >> b >>c>>d ;
  if(a+b>c+d){
    cout<<"Left"<<endl;
  }
  else if (a+b==c+d){
    cout<<"Balanced"<<endl;
  }
  else{
    cout<<"Right"<<endl;
  }
  }
  

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N, C, K;
  cin >> N >> C >> K;
  vector<long> T(N);
  rep (i, N) cin >> T[i];

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

  long ret = 0;
  long passenger = 0;
  long limit = 0;

  rep (i, N) {
    if (passenger == 0) {
      passenger = 1;
      ret ++;
      limit = T[i] + K;
    } else if (T[i] > limit) {
      passenger = 1;
      ret ++;
      limit = T[i] + K;
    } else if (passenger == C) {
      passenger = 1;
      ret ++;
      limit = T[i] + K;
    } else passenger++;
  }

  cout << ret << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

#define MOD long(1e18)

using namespace std;

long q_pow(long x, long n){
    if(n == 0) return 1;
    if(n == 1) return x;
    else if(n%2 == 0) return q_pow(x*x, n/2);
    else return x * q_pow(x, n-1);
}

string n_ary_convert(long n, long ary){
    if(n == 0) return "0";
    string ans = "";
    while(n != 0){
        if(n < 0){
            long temp = -n % ary;
            ans += to_string(temp);
            n = n / ary;
            if(temp == 0) continue;
            if(ary < 0) n++;
            else n--; 
        }
        else{
            ans += to_string(n % ary);
            n /= ary;
        }
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

long fnum(long x, int f){
    long ans = 0;
    ans += pow(2, f) * (x / long(pow(2, f + 1)));
    ans += max(long(x % long(pow(2, f + 1)) - pow(2, f)), 0l);
    return ans;
}

void g(long x, long * d, int N){
    for(int i=0; i<N; i++){
        d[i] = fnum(x, i);
    }
}

int main(){
    long A, B;
    cin >> A >> B;
    int N = n_ary_convert(B, 2).length();
    long da[N], db[N];
    g(A, da, N); g(B+1, db, N);
    long ans = 0;
    for(int i=0; i<N; i++){
        if((db[i] - da[i]) % 2 == 1){
            ans += pow(2, i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    set<int> s;
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int c;
        cin>>c;
        s.insert(c);
    }
    if(s.size()==n)
        cout<<"YES\n";
    else cout<<"NO\n";
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n;
  cin >> n;
  vec a(n);
  for(ll i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  cout << a[a.size()/2]-a[(a.size()-1)/2] << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e6 + 6;
const ll MOD = 1e9+7;
 
int parent[N];
 
int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 
 
ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
        // is different from
        // res *= (n -r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}

void solve() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * c, max(a * d, max(b * c, b * d))) << endl;
    return;
} 

int main()
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) 
    solve();
    return 0; 
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int N=2e5+9;
int main()
{
    FASTINOUT;
    int x,m;
    cin>>x>>m;
    vector<int>v;
    for (int i=1;i<=sqrtl(m);i++){
        if (m%i==0){
            v.push_back(i);
            v.push_back(m/i);
        }
    }
    int ans=1;
    for (int i=0;i<v.size();i++){
        if (v[i]<=m/x+(m%x!=0))
            ans=max(ans,v[i]);
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

long long int MOD = 998244353;

int N, S, A[3333];

long long int dp[3030][6030];


int main(void) {
	cin >> N >> S;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}
	//cout << "check" << endl;

	dp[0][0] = 1;

	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= 3000; j++) {
			dp[i][j] += dp[i - 1][j]*2; dp[i][j] %= MOD;
			dp[i][j + A[i]] += dp[i - 1][j]; dp[i][j + A[i]] %= MOD;
		}
	}

	/*for (int j = 0; j <= 10; j++) {
		cout << "dp[" << N << "][" << j << "]= " << dp[N][j] << endl;
	}*/


	long long int ans = dp[N][S];



	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 115784
#include<bits/stdc++.h>
using namespace std;
int main(){
 int N,M;
  cin>>N>>M;
  vector<int> a(M),b(M); 
  int i,j;
  for(i=0;i<M;i++){
      cin>>a.at(i)>>b.at(i);
  }
  vector<int> count(N);
  for(i=0;i<M;i++){
  	for(j=0;j<N;j++){
  		if(j+1==a.at(i)) count.at(j)++;
  		if(j+1==b.at(i)) count.at(j)++;
  	}
  }
  for(i=0;i<N;i++) cout<<count.at(i)<<endl;
}


Measured memory_bytes: 256
# ABC 056
# 基本
import math
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def getIntFromRows(n): return [int(input()) for i in range(n)]
def getIntMat(n):
    mat = []
    for i in range(n): mat.append(getIntList())
    return mat

def zeros(n): return [0 for i in range(n)]
def zeros2(n, m): return [[0 for i in range(m)] for j in range(n)]
N1097 = 10**9 + 7 

W, a, b = getIntList()
if b>=a+W: m = b-a-W
elif a>=b+W: m = a-b-W
else: m = 0
print(m)



Measured memory_bytes: 3064
import java.util.*;
//import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        String str = sc.nextLine();
 //       char [] c = new char[str.length()];
        StringBuilder result =new StringBuilder();//変換した文字を入れる
        
        for( int i = 0;i<str.length();i++){
            char c = str.charAt(i);//一文字づつみていく
            
   //         System.out.println("@"+c);
            
            
            if(Character.isLowerCase(c)){
                result.append(Character.toUpperCase(c));
            }else if(Character.isUpperCase(c)){
                result.append(Character.toLowerCase(c));
            }else{
                result.append(c);
            }
 //           System.out.println(result.toString());
 //           System.out.println(result);
        }System.out.println(result);
    }
}




Measured memory_bytes: 26076
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define pb push_back
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const int maxM = 1e6+10;
const int inf = 0x3f3f3f3f;
const ll inf2 = 0x3f3f3f3f3f3f3f3f;

template<class T>void read(T &x){
    T s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    x = s*w;
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
int N;
set<string> st;
void solve(){
	
}	
int main(){
	// debug;
	ios;

	cin>>N;
	for(int i = 1;i<=N;i++) {
		string s;cin>>s;
		st.insert(s);
	}
	cout<<st.size()<<'\n';
	return 0;
}


Measured memory_bytes: 19180
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

double distance(int a, int b, int c, int d){
    double dx = c - a;
    double dy = d - b;
    double dis = std::pow(dx*dx+dy*dy, 0.5);
    return dis;
}

int main(){
    int n;
    std::cin >> n;

    std::vector<int> x(n+1), y(n+1), v(n);
    x[0] = 0, y[0] = 0;
    for(int i = 0; i < n; i++) {
        std::cin >> x[i+1] >> y[i+1];
        v[i] = i + 1;
    }

    double sum_of_distance = 0.0;
    
    do{
        for(int i = 0; i < n-1; i++) sum_of_distance += distance(x[v[i]], y[v[i]], x[v[i+1]], y[v[i+1]]);
    }while(next_permutation(v.begin(), v.end()));

    double factorial = 1;
    for(int i = 2; i <= n; i++) factorial *= i;

    double ans = sum_of_distance / factorial;
    printf("%lf\n", ans);
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(i => long.Parse(i)).ToArray();

            var x = a[0];
            for(var i = 1; i < n; i++){
                x = Gcd(a[i], x);
            }

            Console.WriteLine(x);
        }

        static long Gcd(long m, long n)
        {
	        while (m % n != 0){
        		var temp = n;
		        n = m % n;
		        m = temp;
	        }
        	return n;
        }
    }
}


Measured memory_bytes: 22880
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
//#define int long  long int
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }

signed main(){
	string n;
	cin >> n;
	rep(i, n.size()) {
		if (n[i] == '1')n[i] = '9';
		else n[i] = '1';
	}
	cout << n;
}

Measured memory_bytes: 256
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n;cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    resort(a);
    int count = 0;
    int cnt = 0;
    rep(i, n) {
        if(i%2==0)count+=a[i];
        else cnt+=a[i];
    }
    cout << count - cnt << endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{int n;cin>>n;string s;cin>>s;
int x=0,mx=0;
for(int i=0;i<n;i++)
{if(s[i]=='I')
{x++;
}
mx=max(x,mx);

if(s[i]=='D')
{x--;
}}
cout<<mx;
return 0;
}

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

int main() {
  int h, w, i, j, dx[8] = {0,1,0,-1,1,1,-1,-1}, dy[8] = {1,0,-1,0,1,-1,1,-1};
  string s[50];
  cin >> h >> w;
  for(i=0; i<h; i++) cin >> s[i];
  for(i=0; i<h; i++){
    for(j=0; j<w; j++){
      if(s[i].at(j) != '#'){
        int num=0, k;
        for(k=0; k<8; k++){
          int x=j+dx[k], y=i+dy[k];
          if(x>=0 && x<=w-1 && y>=0 && y<=h-1 && s[y].at(x) == '#') num++; 
        }
        s[i].at(j) = to_string(num).at(0);
      }
    }
    cout << s[i] << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,k;
vl a,s,b;

int main(){
	cin>>n>>k;
	a=vl(n);
	s=vl(n+1);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=1;i<=n;i++) s[i]=s[i-1]+a[i-1];
	for(int i=0;i<n;i++) for(int j=i+1;j<=n;j++) b.push_back(s[j]-s[i]);
	for(int i=50;i>=0;i--){
		int t=0;
		vl c;
		for(auto j:b) if(j&1ll<<i) c.push_back(j);
		if(c.size()>=k) b=c;
	}
	ll res=INF-1;
	for(int i=0;i<k;i++) res&=b[i];
	cout<<res<<endl;
}

Measured memory_bytes: 6516
//#define NDEBUG
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

struct rep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
struct revrep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) noexcept {
  return a < b ? b - a : a - b;
}
template <class T> void chmin(T &a, const T &b) noexcept {
  if (b < a)
    a = b;
}
template <class T> void chmax(T &a, const T &b) noexcept {
  if (a < b)
    a = b;
}
template <class F> class fix_point : private F {
public:
  explicit constexpr fix_point(F &&f) : F(std::forward<F>(f)) {}

  template <class... Args>
  constexpr decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};
template <class F> constexpr decltype(auto) make_fix(F &&f) {
  return fix_point<F>(std::forward<F>(f));
}
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91
#include <array>
#include <map>
#include <string>

namespace n91 {

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const usize n = scan<usize>();
  std::map<std::string, usize> cnt;
  for (const usize i : rep(0, n)) {
    const std::string s = scan<std::string>();
    cnt[s] += 1;
  }
  usize max = 0;
  for (const auto &e : cnt)
    max = std::max(max, e.second);
  for (const auto &e : cnt) {
    if (max == e.second) {
      std::cout << e.first << std::endl;
    }
  }
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 17664
#include<stdio.h>
#include<string.h>
int main(){
    int a[27]={0};
    char ch[50];
    gets(ch);
    for(int i=0;i<strlen(ch);i++){
        if(!a[ch[i]-97]) a[ch[i]-97]++;
        else{
            puts("no");
            return 0;
        }
    }
    puts("yes");
    return 0;
}



Measured memory_bytes: 128
#include <stdio.h>
int main()
{
    int a,b,c,d,co=0;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    for (int i=0;i<=a;i++)
        for (int j=0;j<=b;j++)
            for (int k=0;k<=c;k++)
                if (i*500+j*100+k*50==d)co++;
    printf ("%d\n",co);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define li long long int
#define ld long double
#define F first
#define S second
//const li M = 1000000007;
#define ld long double
li dx[]={-1,1,0,0};
li dy[]={0,0,-1,1};

int main()
{
	li N,K,i,j; cin>>N;
	vector<li> A(N);
	li tot=0;
	for(i=0;i<N;i++)
	{
		cin>>A[i]; tot=tot^A[i];
	}
	for(i=0;i<N;i++)
	{
		cout<<(tot^A[i])<<" ";
	}
	
}



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

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)b; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, r, l) for (int i = (r); i >= (l); i--)
#define ms(x, y) memset(x, y, sizeof(x))

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int n;
map<int, int> vis;

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin);
#endif

	cin >> n;
	vi a(n);
	bool ok = true;
	forn(i, n) {
        cin >> a[i];
        ok &= (vis[a[i]] == 0);
        ++vis[a[i]];
	}
	if (ok) cout << "YES" << '\n';
	else cout << "NO" << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 10368
n, m = list(map(int, input().split(' ')))
A = []
b = []
for i in range(n):
  A.append(list(map(int, input().split(' '))))
for i in range(m):
  b.append(int(input()))
for i in range(n):
  s = 0
  for x in range(m):
    s += A[i][x] * b[x]
  print(s)


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

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

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

    const int N = 100000;

    for(int x = 1; x < N; x++) {
        int A = (x * 8) / 100;
        int B = (x * 10) / 100;

        if(A == a && B == b) {
            cout << x << '\n';
            return 0;
        }
    }

    cout << "-1\n";

    return 0;
}


Measured memory_bytes: 256
n = int(input())
t = [int(input()) for i in range(n)]

t = list(set(t))

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b,a%b)

if len(t)==1:
  print(t[0])
  exit()
  
koubai = t[0]
for i in range(1,len(t)):
  kouyakusuu = gcd(koubai,t[i])   
  koubai = koubai*t[i]//kouyakusuu
print(koubai)

Measured memory_bytes: 3064
import math

def main():
	n = int(input())
	ans = ""

	i = 0

	if n == 0:
		print(0)
		return 

	while n != 0:
		if n % (2 ** (i + 1)) != 0:
			ans += "1"
			n -= (-2) ** i
		else:
			ans += "0"

		i += 1

	print(ans[::-1])

if __name__ == '__main__':
	main()

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

int main() {
  int A,B;
  string op;
    cin>>A>>op>>B;
    
  if (op=="+"){
    cout << A+B <<endl;
  }
  
  else if (op=="-"){
    cout << A-B << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
int main(){
  int t=0,h=0;
  int a,b,c;
  char d;
  while(cin>>a>>d>>b>>d>>c){
    if(c==hypot(a,b))t++;
	if(a==b)h++;
  }
  cout<<t<<endl<<h<<endl;
}

Measured memory_bytes: 1172
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static void Main() {
        string[] s = Console.ReadLine().Split(' ');
        List<int> v = new List<int>();
        foreach(var tmp in s) {
            v.Add(int.Parse(tmp));
        }

        if(v[0] >= 10) {
            Console.WriteLine(v[1]);
        }
        else {
            int ans = v[1] + (100 * (10 - v[0]));
            Console.WriteLine(ans);
        }
    }
}


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

using namespace std;

int gcd(int a, int b) {
    if (b < a) return gcd(b, a);
    if (a == 1) return 1;
    if (a == 0) return b;
    return gcd(a, b-a);
}

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

    long long result = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                result += gcd(i, gcd(j, k));
            }
        }
    }

    cout << result;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
int n;
string s,t;
int main(){
  cin >> n >> s >> t;
  for (size_t i = 0; i < n; i++) {
    cout << s[i] << t[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
idx = int(input())
in_dict = {}

for i in range(idx):
    b, f, r, v = (int(x) for x in input().split())
    b -= 1
    f -= 1
    r -= 1
    in_dict[(b,f,r)] = in_dict.get((b,f,r),0) + v

for b in range(4):
    for f in range(3):
        for r in range(10):
            print(" ",end="")
            print(in_dict.get((b,f,r),0), end="")
        print("\n", end="")
    if b in range(3):print("#"*20)

Measured memory_bytes: 7744