akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,j,n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 998244353;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
 
i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

  string s;
  cin >> s;

  if(s == "AAA" || s == "BBB") cout << "No\n";
  else cout << "Yes\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

char alpha;

int main() {
	cin >> alpha;
	if (alpha < 'a') {
		cout << 'A' << endl;
	}
	else {
		cout << 'a' << endl;
	}
	return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int[] map = new int[220000];
		int[] ppcount = new int[220000];
		map[0] = 0;
		map[1] = 1;
		ppcount[0] = 0;
		ppcount[1] = 1;
		for (int i = 2; i < 220000; i++) {
			ppcount[i] = ppcount[i / 2] + i % 2;
			map[i] = map[i % ppcount[i]] + 1;
		}

		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		String n = sc.next();

		char[] array = n.toCharArray();
		int count = 0;
		for (int i = 0; i < array.length; i++) {
			if (array[i] == '1') {
				count++;
			}
		}
		int oneMod = 0;
		int zeroMod = 0;
		int oneCount = count + 1;
		int zeroCount = count - 1;
		for (int i = 0; i < array.length; i++) {
			int i1 = Integer.parseInt(String.valueOf(array[i]));
			oneMod = ((oneMod * 2) + i1) % oneCount;
			if (zeroCount > 0) {
				zeroMod = ((zeroMod * 2) + i1) % zeroCount;
			}
		}

		for (int i = 0; i < array.length; i++) {
			if (array[i] == '0') {
				int mode = (int)expMod(2, array.length - 1 - i, oneCount);
				int temp = (oneMod + mode) % oneCount;
				System.out.println(map[temp] + 1);
			} else {
				if (zeroCount == 0) {
					System.out.println(0);
				} else {
					int mode = (int)expMod(2, array.length - 1 - i, zeroCount);
					int temp = (zeroMod - mode) % zeroCount;
					if (temp < 0) {
						temp += zeroCount;
					}
					System.out.println(map[temp] + 1);
				}
			}
		}

	}

	private static int binaryMod(String binaryString, int mod) {
		if (mod == 0) {
			return -1;
		}
		int temp = 0;
		for (int i = 0; i < binaryString.length(); i++) {
			temp = temp % mod;
			temp = (temp * 2) + Integer.valueOf(String.valueOf(binaryString.charAt(i)));
		}
		return temp % mod;
	}


	private static long expMod(long a, long n, long mod) {
		long t;
		if (n == 0) return 1 % mod;
		if (n == 1) return a % mod;
		t = expMod(a, n / 2, mod);
		t = (t * t) % mod;
		if ((n & 1) == 1) t = (t * a) % mod;
		return t;
	}
}



Measured memory_bytes: 60180
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
  long long int i,ans=0;
  cin>>s;
  for(i=0;i<3;i++) if(s[i]=='R') ans++;
  if(ans==3) cout<<"3\n";
  else if(ans==2 && s[1]!='S') cout<<"2\n";
  else if(ans==2) cout<<"1\n";
  else cout<<ans<<"\n";
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;
typedef vector< pll >   vpll;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(s,e)     ((s)+((e)-(s))/2) 

#define fo(i,a,b)     for(ll i = (ll)(a); i <= (ll)(b); i++)
#define rf(i,a,b)    for(ll i = (ll)(a); i >= (ll)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***


ll power(ll x,  ll y, ll p = LLONG_MAX)
{
    // re x^y if p not specified else (x^y)%p
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    if(p==LLONG_MAX) return res%p;
    else return (res+p)%p;
}

void solve()
{
    int n,k;rd(n,k);
    int num[k+1] = {0};
    rf(i,k,1){
        num[i] = power(k/i,n,mod);
        for(ll j=2*i;j<=k;j+=i){
            num[i]-=num[j];
            num[i] %= mod;
        }
    }  
    ll ans = 0;
    fo(i,1,k){
        ans += i*num[i];
        ans %= mod;
    }
    pp(ans);
    
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 3992
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VI a(n), b(n);
    REP(i,0,n) cin >> a[i];
    sort(all(a));
    LL sum = 0;
    if (n % 2 == 0) {
        b[0] = a[n/2-1];
        b[n-1] = a[n/2];
        REP(i,0,n/2-1) b[(i+1)*2] = a[i];
        REP(i,0,n/2-1) b[i*2+1] = a[i+n/2+1];
        //REP(i,0,n) cout << b[i] << endl;
        REP(i,0,n-1) sum += abs(b[i] - b[i+1]);
    } else {
        b[0] = a[n/2];
        {
            LL tmp = 0;
            b[n-1] = a[n/2-1];
            REP(i,0,n/2-1) b[(i+1)*2] = a[i];
            REP(i,0,n/2) b[i*2+1] = a[i+n/2+1];
            //REP(i,0,n) cout << b[i] << endl;
            REP(i,0,n-1) tmp += abs(b[i] - b[i+1]);
            sum = max(sum, tmp);
        }
        {
            LL tmp = 0;
            b[n-1] = a[n/2+1];
            REP(i,0,n/2-1) b[(i+1)*2] = a[n-1-i];
            REP(i,0,n/2) b[i*2+1] = a[n-1-(i+n/2+1)];
            //REP(i,0,n) cout << b[i] << endl;
            REP(i,0,n-1) tmp += abs(b[i] - b[i+1]);
            sum = max(sum, tmp);
        }
    }
    cout << sum << endl;
}

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

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

/*
    AOJ 2170 Marked Ancestor
*/

/*
6 3
1
1
2
3
3
Q 5
M 3
Q 5
0 0


4
*/

typedef long long ll;

const ll MAX_N = 1e5 + 10;
const ll MAX_Q = 1e5 + 10;

ll N = 0;
ll Q = 0;
char OP[MAX_Q];
ll NUM[MAX_Q];

// 实现并查集
ll par[MAX_N + 1];
ll rnk[MAX_N + 1];

void init(ll n) {
    for (ll i = 0; i <= n; i++) {
        par[i] = i;
        rnk[i] = 0;
    }
}

ll find(ll x) {
    if (par[x] == x) {
        return x;
    }

    return find(par[x]);    // 在本题, 这个不能使用路径压缩策略. 因为本质上并不是并查集. 而只是一棵普通的树.
}

void solve() {
    ll res = 0;
    for (ll i = 0; i < Q; i++) {
        if (OP[i] == 'Q') {
            res += find(NUM[i]);
        }
        else if (OP[i] == 'M') {
            ll tmp = NUM[i];
            par[tmp] = tmp;
        }
    }

    printf("%lld\n", res);
}

int main() {
    while (scanf("%lld %lld", &N, &Q) != EOF) {
        if (N == 0 && Q == 0) {
            break;
        }

        init(N);
        for (ll i = 2; i <= N; i++) {
            scanf("%lld", &par[i]);
        }
        getchar();
        for (ll i = 0; i < Q; i++) {
            scanf("%c %lld", &OP[i], &NUM[i]);
            getchar();
        }

        solve();
    }

    return 0;
}



Measured memory_bytes: 5584
def resolve():
    big_num = 1000
    n = int(input())
    if n == 0:
        print(0)
    else:
        s = ""
        while n != 0:
            if n % 2 != 0:
                n -= 1
                s = "1" + s
            else:
                s = "0" + s
            n //= -2
        print(s)
        
resolve()

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

const int INF = 1e9;
struct edge{
    int to, cost;
};

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

    int v, e, r;
    cin >> v >> e >> r;

    vector<edge> G[v];
    for(int i = 0; i < e; i++){
        int s, t, d;
        cin >> s >> t >> d;
        G[s].push_back({t, d});
        //G[t].push_back({s, d}); いらんのです????????
    }

    int D[v];
    for(int i = 0; i < v; i++){
        D[i] = INF;
    }
    D[r] = 0;

    bool f = true;
    int cnt = 0;
    while(f){
        if(cnt > v) break;
        cnt++;
        f = false;
        for(int i = 0; i < v; i++){
            for(int j = 0; j < G[i].size(); j++){
                edge e = G[i][j];
                if(D[e.to] > D[i] + e.cost and D[i] != INF){
                    D[e.to] = D[i] + e.cost;
                    f = true;
                }
            }
        }
    }

    if(cnt > v){
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }

    for(int i = 0; i < v; i++){
        if(D[i] == INF) cout << "INF" << endl;
        else cout << D[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3216
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();

        int result = t / a;
        result = result * b;

        System.out.println(result);
	}
}


Measured memory_bytes: 21332
#include <iostream>

using namespace std;

int n;
int a, b;
int n0, n1, n2;

int main(void)
{
	cin >> n >> a >> b;
	for(int i = 0; i < n; i++){
		int p;
		cin >> p;
		if(p <= a) n0++;
		else if(p <= b) n1++;
		else n2++;
	}
	cout << min(n0, min(n1, n2)) <<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    int a,b;
    cin >> a >> b;
    cout << (b - a) * (b - a + 1) / 2 - b << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input().strip())
a=[0]*N
b=[0]*N
for i in range(N):
    a[i],b[i]= list(map(int, input().strip().split()))
f="No"
for i in range(N-2):
    if a[i]==b[i] and  a[i+1]==b[i+1] and   a[i+2]==b[i+2] :
        f="Yes"
        break
print(f)

Measured memory_bytes: 9180
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
while(1){
	stack<int> num;
	int last=-1;
	int n;
	cin >> n;
	if(n==0)return 0;
	for(int i=0;i<n;i++){
		int v;
		cin >> v;
		int c=1;
		if(last==v){
			if(num.size()>0){
				c+=num.top();
				num.pop();
			}
		}
		else{
			if(i%2==1){
				for(int i=0;i<2;i++){
					if(num.size()>0){
						c+=num.top();
						num.pop();
					}
				}
			}
		}
		num.push(c);
		//cout << v << ": " << c << endl;
		last=v;
	}
	int ret=0;
	while(num.size()){
		if(last==0){
			ret+=num.top();
		}
		num.pop();
		last^=1;
	}
	cout << ret << endl;
}
}

Measured memory_bytes: 1200
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char>> s(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> s[i][j];
    int dx[4] = {1, -1, 0, 0};
    int dy[4] = {0, 0, 1, -1};
    rep(i, h) rep(j, w) {
        if ( s[i][j] == '#' ) {
            int cnt = 0;
            rep(k, 4) {
                int next_dy = i + dy[k];
                int next_dx = j + dx[k];
                if( next_dy >= h || next_dy < 0 || next_dx >= w || next_dx < 0 ) continue;
                if( s[next_dy][next_dx] == '#' ) ++cnt;
            }
            if ( cnt == 0 ) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll temp=ceil(c/(b*1.0));
    ll temp2=ceil(a/(d*1.0));
    if(temp<=temp2){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 3756
N, M = list(map(int, input().split()))

room_dict = {i+1:[] for i in range(N)}
for _ in range(M):
  _a, _b = list(map(int, input().split()))
  room_dict[_a].append(_b)
  room_dict[_b].append(_a)

rooms = set(room_dict.keys())
s_dict = {i+1:None for i in range(1, N)}
traversed_rooms = set([1])

now_rooms = [1]
from operator import add
while now_rooms:
    next_rooms = set()
    for _room in now_rooms:
        traversed_rooms.add(_room) # 訪問済みを保存
        _n_rooms  = [i for i in room_dict[_room] 
                         if (not i in traversed_rooms) and (s_dict[i] is None)]
        for n_room in _n_rooms:
            next_rooms.add(n_room) # 今の次の階層を、次のiteration用に入れる
            s_dict[n_room] = _room # 次の階層は、今の階層への道標を置けば十分
    now_rooms = [i for i in next_rooms if not i in traversed_rooms] # まだ訪れてない部屋を探す
    
print('Yes') # 常に答えは存在する

for i in range(2, N+1):
    print(s_dict[i])

Measured memory_bytes: 61976
O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)-1):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  cout << a - (a <= b ? 0 : 1) << '\n';
  return 0;
}


Measured memory_bytes: 256
n, t = map(int, input().split())
foods = [list(map(int, input().split())) for _ in range(n)]
dp = [[0 for _ in range(t)] for _ in range(n)]
ans = 0

foods.sort(key=lambda x: x[0])

for food in range(n-1):
    for time in range(t):
        if time - foods[food][0] >= 0:
            dp[food+1][time] = max(dp[food][time], dp[food][time-foods[food][0]] + foods[food][1])
        else:
            dp[food+1][time] = dp[food][time]

for i in range(n):
    ans = max(ans, dp[i][t-1] + foods[i][1])

#ans = dp[-1][t-2] + foods[-1][1]
print(ans)


Measured memory_bytes: 123856
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n;
  ll sum = 0;
  ll sum2 = 0;
  cin >> n;
  vector<ll> a(n);
  vector<ll> b(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  sort(a.begin(), a.end());
  if (n == 3) {
    sum += abs(a[0]-a[2]);
    sum += max(abs(a[1]-a[0]), abs(a[1]-a[2]));
    cout << sum << endl;
    return 0;
  }
  b[n/2] = a[0];
  ll p = 0;
  bool big = true;
  for (int i = 0; i < n/2; i++) {
    if (big) {
      b[n/2-(i + 1)] = a[n-1 -i];
      b[n/2+(i + 1)] = a[n-2 -i];
      big = false;
    }
    else {
      b[n/2-(i + 1)] = a[p+1];
      b[n/2+(i + 1)] = a[p+2];
      p += 2;
      big = true;
    }
  }
  for (int i = 0; i < n-1; i++) {
    sum += abs(b[i] - b[i+1]);
  }
  

  b[n/2] = a[n-1];
  p = 0;
  big = false;
  for (int i = 0; i < n/2; i++) {
    if (big) {
      b[n/2-(i + 1)] = a[n-1 -i];
      b[n/2+(i + 1)] = a[n-2 -i];
      big = false;
    }
    else {
      b[n/2-(i + 1)] = a[p];
      b[n/2+(i + 1)] = a[p+1];
      p += 2;
      big = true;
    }
  }
  for (int i = 0; i < n-1; i++) {
    sum2 += abs(b[i] - b[i+1]);
  }

  cout << max(sum, sum2) << endl;
  return 0;
}


Measured memory_bytes: 1792
# 幅優先探索による全探索
from collections import deque
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def bfs(N):
    """
    param N:文字列の長さ

    """
    S = "abcdefghij"
    result = []
    queue = deque(["a"])
    
    while queue:
        s = queue.popleft()
        if len(s) == N:
            result.append(s)
            continue
        else:
            for i in S[:len(set(s))+1]:
                queue.append(s + i)
    
    return result


def main():
    N = int(readline())

    ans = bfs(N)
    print("\n".join(ans))


if __name__ == "__main__":
    main()


Measured memory_bytes: 16340
// #include <bits/stdc++.h>
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>
#include<functional>
#include <bitset>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;
static const int MAX = 100005;
// static const int NMAX = 5005;

// typedef priority_queue<int, greater<int>> RevQ;
int N, K;
// vector<int> a(MAX);



int main(){
  cin >> N >> K;
  int cnt = 0;
  int b;
  rep(i,N) {
    cin >> b;
    if (b >= K) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF 1000000007
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;


int main()
{
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, 0, n)cin >> a[i];
	bool ans = true;
	rep(i, 0, n) {
		if (a[i] % 2==0) {
			if (a[i] % 3 > 0 && a[i] % 5 > 0) {
				ans = false;
				break;
			}
		}
	}
	if (ans)cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main()
{
    int n;
    double sum = 0;
    cin >> n;
    int x[n];
    REP(i, n){
        cin >> x[i];
        sum += x[i];
    }
    int ave = int(double(sum / n) + 0.5);
    sum = 0;
    REP(i, n){
        sum += (x[i] - ave) * (x[i] - ave);
    }
    cout << sum << endl;
}


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

int n;
int lix[105],liy[105],lih[105];
int main()
{
   scanf("%d",&n);
   for(int i=1;i<=n;i++)
   {
      scanf("%d%d%d",&lix[i],&liy[i],&lih[i]);
   }
   for(int cx = 0;cx<=100;cx++)
   {
      for(int cy = 0;cy<=100;cy++)
      {
         int H = 0;
         for(int j=1;j<=n;j++)
         {
            if(lih[j]==0) continue;
            H = lih[j] + abs(lix[j]-cx) + abs(liy[j]-cy);
            bool val = 1;
            for(int i=1;i<=n;i++)
            {
               int tmp = max(H - abs(lix[i]-cx) - abs(liy[i]-cy),0);
               if(tmp!=lih[i])
               {
                  val = 0;
                  break;
               }
            }
            if(val)
            {
               printf("%d %d %d\n",cx,cy,H);
               return 0;
            }
         }
      }
   }
 	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;


int main(){

    string S;
    int ans=700;
    cin >>S;

    if(S[0]=='o')ans+=100;
    if(S[1]=='o')ans+=100;
    if(S[2]=='o')ans+=100;

    cout << ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s;
  cin >> s;
  int N = s.size();

  ll sum = 0LL;
  ll tmp;
  for(int bit = 0; bit < (1 << N-1); bit++){
    tmp = s[0] - '0';
    for(int i = 0; i < N-1; i++){
      if(bit&(1 << i)){
        //足し算を入れる
        sum += tmp;
        tmp = s[i+1] - '0';
      }else{
        //足し算を入れない⇔10倍？
        tmp *= 10;
        tmp += s[i+1] - '0';
      }
    }
    sum += tmp;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    ans += min(A[i] + A[i+1], B[i])
    A[i+1] = max(A[i+1]-max(B[i]-A[i], 0), 0)
    # print(A, B)
print(ans)


Measured memory_bytes: 82148
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Measured memory_bytes: 12500
#include<iostream>
#include<string>
#include<cmath>

using namespace std;

void DevideColor(string, int&, int&, int&);
int Atoi16(char);
double Calculate(int, int, int, int, int, int);

int main(){
  int i, Red, Green, Blue;
  double min, font[8];
  string Color, StrongColor;
  string color[8] = {"black", "blue", "lime", "aqua", "red", "fuchsia","yellow", "white"};

  while(1){
    cin >> Color;
    if(Color == "0") break;

    DevideColor(Color, Red, Green, Blue);

    font[0] = Calculate(Red, Green, Blue, 0, 0, 0);
    font[1] = Calculate(Red, Green, Blue, 0, 0, 255);
    font[2] = Calculate(Red, Green, Blue, 0, 255, 0);
    font[3] = Calculate(Red, Green, Blue, 0, 255, 255);
    font[4] = Calculate(Red, Green, Blue, 255, 0, 0);
    font[5] = Calculate(Red, Green, Blue, 255, 0, 255);
    font[6] = Calculate(Red, Green, Blue, 255, 255, 0);
    font[7] = Calculate(Red, Green, Blue, 255, 255, 255);

    min = font[0];
    StrongColor = color[0];

    for(i=1; i<8; ++i){
      if(font[i] < min){
        min = font[i];
        StrongColor = color[i];
      }
    }

    cout << StrongColor << endl;
  }

  return 0;

}

void DevideColor(string s, int& r, int& g, int& b){
  string R, G, B;
  copy(s.begin()+1, s.begin()+3, back_inserter(R));
  copy(s.begin()+3, s.begin()+5, back_inserter(G));
  copy(s.begin()+5, s.end(), back_inserter(B));
  r = Atoi16(R[0])*16 + Atoi16(R[1]);
  g = Atoi16(G[0])*16 + Atoi16(G[1]);
  b = Atoi16(B[0])*16 + Atoi16(B[1]);
}

int Atoi16(char c){
  int x;
  if(c >= '0' && c <= '9')
    x = c - 48;
  else
    x = c - 87;
  return x;
}

double Calculate(int r, int g, int b, int _r, int _g, int _b){
  int R, G, B;
  R = r - _r;
  G = g - _g;
  B = b - _b;
  return sqrt(R*R + G*G + B*B);
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e5+5;
const ll INF=1e18;
const ll MOD=998244353;
const double pi=3.1415926;
ll n,a[MAXN],g1[MAXN],g2[MAXN];
void solve()
{
    g1[1]=a[1];
    for(ll i=2;i<=n;i++)
    {
        g1[i]=__gcd(g1[i-1],a[i]);
    }
    g2[n]=a[n];
    for(ll i=n-1;i>=1;i--)
    {
        g2[i]=__gcd(g2[i+1],a[i]);
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    {
        if(i==1)
        {
            ans=max(ans,g2[2]);
        }
        else if(i==n)
        {
            ans=max(ans,g1[n-1]);
        }
        else
        {
            ans=max(ans,__gcd(g1[i-1],g2[i+1]));
        }
    }
    printf("%lld\n",ans);
}
int main()
{
//    freopen("c://duipai//data.txt","r",stdin);
//    freopen("c://duipai//wa.txt","w",stdout);

    while(~scanf("%lld",&n))
    {
//        string str;
//        cin>>str;
//        cout<<str<<endl;
        for(ll i=1;i<=n;i++)
        {
            scanf("%lld",&a[i]);
        }
        solve();
    }
}
/*
100
3
1 1
1
4
1 1 1
1 1
1
*/


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
double pi = acos(-1.0);
const double EPS=1e-9;
#define MOD ll(1e9L+7)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define t() ll tt;cin>>tt;while(tt--) 
#define t2() ll tt2; cin>>tt2; for(ll tti=1;tti<=tt2;tti++)
#define printcj "Case #"<<tti<<": "
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cout << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define debug3(x, y,z) cout << #x << " = " << x << "   " << #y << " = " << y << " "<<#z<<" = "<<z<<"\n";
#define debugarray(arr,n) { cout << "[" ; for(ll i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"] , \n";}


vector<ll>segtree,dp;
void update(ll index,ll start,ll end,ll i,ll newvalue)
{
    //outside
    if(i<start || i>end) return ;
    if(start==end) {
        dp[start]=segtree[index]=newvalue;
        return ;
    }
    ll mid = (start+end)/2;
    update(2*index+1,start,mid,i,newvalue);
    update(2*index+2,mid+1,end,i,newvalue);
    segtree[index]=max(segtree[2*index+1],segtree[2*index+2]);
}
ll query(ll index,ll start,ll end,ll l ,ll r)
{
    //outside
    if(r<start || l>end) return LLONG_MIN;
    //inside 
    if(start>=l && end<=r) return segtree[index];
    ll mid = (start+end)/2;
    ll left = query(2*index+1,start,mid,l,r);
    ll right = query(2*index+2,mid+1,end,l,r);
    return max(left,right);
}


int main()
{

    ll n;
    cin>>n;
    vector<ll>h(n),a(n);
    for(auto &it:h)cin>>it;
    for(auto &it:a) cin>>it;
    dp = vector<ll>(n+1);
    segtree= vector<ll>(4*n+4);

    for(ll i=0;i<n;i++){
        ll mx = query(0,0,n,0,h[i]-1);
        update(0,0,n,h[i],mx+a[i]);
    }
    ll ans = query(0,0,n,1,n);
    cout<<ans;

}

Measured memory_bytes: 14356
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,m=MI()
    hh=LI()
    good=[True]*n

    for _ in range(m):
        a,b=MI1()
        if hh[a]==hh[b]:
            good[a]=False
            good[b]=False
        if hh[a]<hh[b]:
            good[a]=False
        if hh[a]>hh[b]:
            good[b]=False
    print(sum(good))

main()

Measured memory_bytes: 20364
N = int(input())
a = [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]
print(a[N-1])

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
char s1[10005];
char s2[10005];
int main()
{
	
	while(scanf("%s",s1)==1)
	{
		scanf("%s",s2);
		int i,j;
		int len=strlen(s1);
		for(i=0;i<len;i++)
		{
			s1[len+i]=s1[i];
		}
		int flag=1;
		for(i=0;i<len;i++)
			{for(j=0;j<len;j++)
			{
				if(s1[i+j]!=s2[j])
				break;
			}
			if(j==len) {flag=0;printf("Yes\n");break;}
			}
			if(i==len) printf("No\n");
		memset(s1,' ',sizeof(s1));
		memset(s2,' ',sizeof(s2));
	}
	return 0;
}

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

int main() {
  string S;
  int Q;
  cin >> S >> Q;
  bool rev = 0;
  string L, R;
  while (Q--) {
    int T;
    cin >> T;
    if (T == 1) rev = !rev;
    else {
      int F;
      char C;
      cin >> F >> C;
      if (F - 1 + rev == 1) R += C;
      else L += C;
    }
  }
  reverse(L.begin(), L.end());
  S = L + S + R;
  if (rev) reverse(S.begin(), S.end());
  cout << S << "\n";
}

Measured memory_bytes: 1348
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] a = new int[n];
        int min = Integer.MAX_VALUE;
        for(int i=0;i<n;i++){
            a[i] = stdIn.nextInt();
            if(min>a[i]) min = a[i];
        }
        for(int i=1;i<=min;i++){
            boolean flag = true;
            for(int j=0;j<n;j++){
                if(a[j]%i!=0){
                    flag = false;
                    break;
                }
            }
            if(flag) System.out.println(i);
        }
    }
}


Measured memory_bytes: 26224
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(a,b) for(int a=0;a<(b);++a)
#define REP1(i,n) for(int i=1;i<=(n);++i)
#define debug(x) cerr<<#x<<": "<<x<<'\n'
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define INF (1<<29)
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


template<class T=int>
T in(){T x;cin>>x;return (x);}
template<class T>
void print(T& x){cout<<x<<'\n';}

const int MOD =(int)1e9+7;
const int mod =(int)1e9+7;
const int MAX =510000;
ll fac[MAX],finv[MAX],inv[MAX];
void COMint(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    if(a>b){
        swap(a,b);
    }
    return gcd(a,b%a);
}
ll lcm(ll a,ll b){
    ll g;g=gcd(a,b);
    return a*b/g;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second < b.second;
    }
}
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;
}

ll RS(ll N,ll P,ll M){
    if(P==0){
        return 1;
    }else{
        if(P%2==0){
            ll t=RS(N,P/2,M);
            return t*t%M;
        }else{
            return N*RS(N,P-1,M)%M;
        }
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    char b;
    cin>>b;
    if(b=='A')cout<<"T"<<endl;
    if(b=='T')cout<<"A"<<endl;
    if(b=='G')cout<<"C"<<endl;
    if(b=='C')cout<<"G"<<endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#import pdb;pdb.set_trace()
import sys
if False:
    fh=open('vol1_0164.txt','r')
else:
    fh=sys.stdin
j=0
a=[]

def ichi(n):
    n -= (n-1) % 5
    return(n)

def ji(n):
    global j    
    if n < a[j]:
        n = 0
    else:
        n -= a[j]
    j = (j+1) % len(a)
    #print('j=',j,' len(a)=',len(a))
    return(n)

while True:
    m = int(fh.readline())
    if m==0:
        break
    a = list(map(int, fh.readline().strip().split()))
    j=0
    n=32
    while True:
        n = ichi(n)
        print(n)
        if n==0:
            #print('ichiro lose')
            break
        n = ji(n)
        print(n)
        if n==0:
            #print('jiro lose')
            break


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;


#define SZ(x) ((int)(x).size())
#define BIT(n) (1ll<<(n))
#define SORT(c) sort((c).begin(),(c).end())
#define RALL(a) (a).rbegin(), (a).rend()
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define CLR(a) memset((a), 0 ,sizeof(a))
#define retrun return
#define INF 1000000010ll
#define MOD 1000000007ll
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define RREP(i,n)  
#define rep(i,n) for(int i=n-1;i>=0;--i)
#define COUT(str) cout << str << endl


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }

string s;
int a, b, c, sum;
int max_pt = INF;
//------------------------------------------------------------------------------------------------------

int main() {
	cin >> s;

	REP(i, 0, s.size()-1) {
		
		string result = s.substr(i, 3);

		int sum = abs(753-stoi(result));
		
		max_pt = min(max_pt, sum);

	}

	COUT(max_pt);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()
#define pi					3.14159265359
ll INF=1e18+10;
ll MOD=1000000007;

const int N=1e5+10;
char s[N];

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    fastio;
    ll n,k;cin>>n>>k;
    cin>>s;
    ll ini=0;
    rep(i,0,n-1)
    if(s[i]=='R' && s[i+1]=='R')
        ini++;
    for(int i=n-1;i>=1;i--)
    if(s[i]=='L' && s[i-1]=='L')
        ini++;

    bool chk=0;
    rep(i,0,n-1)
    {
        if((s[i]=='L' && s[i+1]=='R') || (s[i]=='R' && s[i+1]=='L'))
        {
            if(chk==1)
            {
                if(k>0)
                    ini+=2,chk=0,k-=1;
                else
                    break;
            }
            else
                chk=1;
        }
    }
    if(k>0 && chk)
        ini+=1;
    cout<<ini<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define ppll pair<ll,pair<ll,ll>>
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}
ll f1[N];
ll f2[N];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,p,i,m1,m2,ma,j,f;
    cin>>n>>m>>p;
    ll h[p+1],w[p+1];
    vpll v;
    m1=0;
    m2=0;
    for(i=0;i<p;i++)
    {
    	cin>>h[i]>>w[i];
    	v.pb({h[i],w[i]});
    	f1[h[i]]++;
    	f2[w[i]]++;
    	m1=max(m1,f1[h[i]]);
    	m2=max(m2,f2[w[i]]);
    }
    sort(all(v));
    vll v1,v2;
    for(i=1;i<=n;i++)
    {
    	if(f1[i]==m1)
    	{
    		v1.pb({i});
    	}
    }
    for(i=1;i<=m;i++)
    {
    	if(f2[i]==m2)
    	{
    		v2.pb(i);
    	}
    }
    ma=0;
    pll pi;
    f=1;
    	for(i=0;i<sz(v1);i++)
    	{
    		for(j=0;j<sz(v2);j++)
    		{
    			pi={v1[i],v2[j]};
    			if(binary_search(all(v),pi))
    			{
    				ma=max(ma,m1+m2-1);
    			}
    			else
    			{
    				f=0;
    				ma=max(ma,m1+m2);
    				break;
    			}
    		}
    		if(f==0)
    		{
    			break;
    		}
    	}
    cout<<ma<<"\n";
	return 0;
}

Measured memory_bytes: 26052
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n,m;
    cin>>n>>m;
    vector<string> a(n),b(n);
    for(int i = 0; i < n; i++)
        cin>>a[i];
    for(int i = 0; i < m; i++)
        cin>>b[i];
    for(int i = 0; i <=n-m; i++){
        for(int j = 0; j <=n-m; j++){
            bool jud=true;
            for(int k = 0; k < m; k++){
                if(b[k]!=a[j+k].substr(i,m)){
                    jud=false;
                    break;
                }
            }
            if(jud){
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
  {
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
      int ans1=(n*a);
      int ans2=b;
       if(ans1>=ans2)
           printf("%d",ans2);
  
       else
           printf("%d",ans1);
  }

Measured memory_bytes: 256
#include <cstdio>
#include <queue>

using namespace std;

typedef struct Score {
	Score(int i, int u, int a, int p){
		id = i; school = u; success = a; penalty = p;
	}
	int id, school, success, penalty;
} Score;

typedef struct MyComparator {
	bool operator()(Score &a, Score &b){
		if(a.success < b.success){ return true; }
		if(a.success > b.success){ return false; }
		if(a.penalty > b.penalty){ return true; }
		if(a.penalty < b.penalty){ return false; }
		return (a.id > b.id);
	}
} MyComparator;

int main(){
	while(true){
		int n;
		scanf("%d", &n);
		if(n == 0){ break; }
		priority_queue<Score, vector<Score>, MyComparator> q;
		int cs[1001] = { 0 };
		int rank = 1;
		while(n--){
			int i, u, a, p;
			scanf("%d%d%d%d", &i, &u, &a, &p);
			q.push(Score(i, u, a, p));
		}
		while(!q.empty() && rank <= 26){
			Score s = q.top();
			if(rank <= 10){
				if(cs[s.school] < 3){ printf("%d\n", s.id); rank++; }
			}else if(rank <= 20){
				if(cs[s.school] < 2){ printf("%d\n", s.id); rank++; }
			}else{
				if(cs[s.school] < 1){ printf("%d\n", s.id); rank++; }
			}
			cs[s.school]++;
			q.pop();
		}
	}
	return 0;
}

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

int main(int argc, char const *argv[])
{
	int n;
	string str;
	cin>>n>>str;

	if(str.length() <= n)
		cout<<str<<endl;
	else{
		cout<<str.substr(0,n)<<"..."<<endl;
	}
	return 0;
}

Measured memory_bytes: 3588
//Code is like humor. When you have to explain it, it’s bad.
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;
#define ss second
#define ff first
int32_t main()
{
    fastio;
    int T,n,m,i,j,k,a,b,c;
    T=1;
    while(T --> 0)
    {
        cin>>n;
        unordered_map<int,int> mp;
        vector<int> A(n);
        int ans=0;
        for(i=0;i<n;i++)
        {
            cin>>a;
            A[i]=a;
            mp[a]++;
            if(mp[a]>1)
                ans+=mp[a]-1;
            // cout<<ans<<'\n';
        }
        for(i=0;i<n;i++)
        {
            if(mp[A[i]] > 1)
                cout<<ans-mp[A[i]]+1<<'\n';
            else
                cout<<ans<<'\n';
        }
    }
    return 0;
}

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

using namespace std;

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

int main(){
    string s;
    cin >> s;
    bool bad = false;
    for(int i = 0; i < 4; i++){
        if(i && s[i] == s[i-1])bad = true;
    }
    if(bad)cout << "Bad" << endl;
    else cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
#endif

#include <bits/stdc++.h>

#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

#define popCnt(x) (__builtin_popcountll(x))

typedef long long Long;
const int N = 505;
int dist[N][N];
bool vis[N][N];

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

void dfs(int i, int j, int d) {
  if (d >= dist[i][j]) return;
  dist[i][j] = d;
  d += !vis[i][j];
  for (int x = 0; x < 4; ++x) {
    dfs(i + dx[x], j + dy[x], d);
  }
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int n;
  cin >> n;

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      dist[i][j] = min(min(i - 1, j - 1), min(n - i, n - j));
    }
  }
  for (int i = 0; i <= n + 1; ++i) {
    vis[0][i] = vis[n + 1][i] = vis[i][0] = vis[i][n + 1] = true;
  }
  int res = 0;
  for (int i = 1; i <= n * n; ++i) {
    int c;
    cin >> c;
    --c;
    int x = c / n + 1, y = c % n + 1;
    res += dist[x][y];
    vis[x][y] = true;
    for (int d = 0; d < 4; ++d) {
      dfs(x + dx[d], y + dy[d], dist[x][y]);
    }
  }
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 19932
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 1000000007; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int N, M, D; 
  cin >> N >> M >> D;

  if(D == 0) printf("%.9f\n", 1.0/N*(M-1));
  else printf("%.9f\n", 2.0*(N-D)/N/N*(M-1));

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];
const int INF = 1e9;
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

void solve(long long A, long long B, long long C)
{

    if (A + B < C)
    {
        cout << B + A + B + 1 << endl;
    }
    else
    {
        cout << C + B << endl;
    }
}

int main()
{
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    long long C;
    scanf("%lld", &C);
    solve(A, B, C);
    return 0;
}


Measured memory_bytes: 256