akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
while(readStrToInt(br)){
}
br.close();
}

static boolean readStrToInt(BufferedReader br)throws IOException{
String str=br.readLine();
String[] arr=str.split(" ");
int x=Integer.parseInt(arr[0]);
int y=Integer.parseInt(arr[1]);
if(x==0 &&y==0) return false;
swapNum(x, y);
return true;
}

static void swapNum(int x, int y){
if(x<=y) System.out.println(x+" "+y);
else System.out.println(y+" "+x);
return;
}
}

Measured memory_bytes: 27144
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int n; cin >> n;
  double ans = (double) ((n+1)/2) / n;
  cout << setprecision(10) << fixed << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    map<string, int> v;
    rep(i, n)
    {
        string s;
        cin >> s;
        v[s]++;
    }

    int vMax = 0;
    for (auto p : v)
    {
        if (p.second > vMax)
        {
            vMax = p.second;
        }
    }

    vector<string> b;
    for (auto p : v)
    {
        if (p.second == vMax)
        {
            b.push_back(p.first);
        }
    }
    sort(b.begin(), b.end());

    rep(i, b.size())
    {
        cout << b[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 26868
n, m = list(map(int,input().split()))
h = list(map(int,input().split()))
ma = [0]*n
count = 0
for i in range(m):
    a, b = list(map(int,input().split()))
    ma[a-1] = max(ma[a-1],h[b-1])
    ma[b-1] = max(ma[b-1],h[a-1])

for i in range(n):
    if(ma[i]==0 or h[i]>ma[i]):
        count += 1
print(count)

Measured memory_bytes: 20000
sx,sy,tx,ty = list(map(int,input().split()))
dx = tx-sx
dy = ty-sy

p1 = dx*"R"+dy*"U"
p2 = dx*"L"+dy*"D"
p3 = "D"+(1+dx)*"R"+(1+dy)*"U"+"L"
p4 = "U"+(1+dx)*"L"+(1+dy)*"D"+"R"

print(p1+p2+p3+p4)

Measured memory_bytes: 3060
/*
[agc029] A - Irreversible operation
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

string S;

ll solve() {
    ll ans = 0;
    int cnt_b = 0;
    for (char c : S) {
        if (c == 'B') {
            cnt_b++;
        } else {
            ans += cnt_b;
        }
    }
    return ans;
}

int main() {
    cin >> S;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 640
K, N = [int(x) for x in input().split()]
A = list([int(x) for x in input().split()])

result = []

for i in range(N):
    if i == N - 1:
        result.append(K - A[i] + A[0])
    else:
        result.append(A[i + 1] - A[i])

result.sort()

print(sum(result[:-1]))


Measured memory_bytes: 31640
#include <stdio.h>

int main() {
	int k, x;
	scanf("%d %d", &k, &x);
	for (int i = x - k + 1; i < x + k; i++) {
		if (i > x - k + 1)
			putchar(' ');
		printf("%d", i);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner teclado = new Scanner(System.in);
		int n, k;
		
		int i =0;
		
		
		n=teclado.nextInt();
		k=teclado.nextInt();
		if(1 <= k && k <=n && n <=100) {
		i = (n%k);
		System.out.println(i);
			
		}
		}
	
	}

Measured memory_bytes: 20948
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)n; ++i)

ll table[1000000];
ll pollock[1000001];
ll dp[1000001];
int main() {
	//freopen("Text.txt", "r", stdin);
	
	ll size = 0;
	{
		ll i = 0;
		table[0] = 0;
		while (1000001 > table[i]) {
			i++;
			table[i] = i*(i + 1)*(i + 2) / 6;
		}
		size = i;
	}

	{
		pollock[0] = 0;
		ll current_i = 0;
		REP(i, 1000001) {
			if (i == 0) continue;
			if (table[current_i + 1] == i) {
				pollock[i] = 1; current_i++;
				continue;
			}

			ll minimum = 1000001;
			for (ll j = 1; j <= current_i; j += 1) {
				minimum = min(pollock[i - table[j]] + 1, minimum);
			}
			pollock[i] = minimum;
		}
	}

	{
		dp[0] = 0;
		ll current_i = -3;
		REP(i, 1000001) {
			if (i == 0) continue;
			if (table[current_i + 4] == i) {
				current_i += 4; dp[i] = 1;
				continue;
			}

			ll minimum = 1000001;
			for(ll j=1; j<=current_i; j+=4) {
				minimum = min(dp[i - table[j]]+1, minimum);
			}
			dp[i] = minimum;
		}
	}

	while (true) {
		int n;
		cin >> n;
		if (n==0) break;
		
		cout << pollock[n] << " " << dp[n] << endl;
	}

}

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

int main() {
    int n,k ;
    cin>>n>>k;
    double expectations[n];
    int curr;
    for (int i=0; i<n; i++){
        cin>>curr;
        expectations[i] = (curr+1)/2.0;
    }
    double ans;
    double curr_sum = 0;
    for (int i=0; i<k; i++){
        curr_sum +=expectations[i];
    }
    ans = curr_sum;
    for (int i=k; i<n; i++){
        curr_sum = curr_sum - expectations[i-k] + expectations[i];     
        ans = max(ans, curr_sum);
    }
    cout<<fixed<<setprecision(12)<<ans;
}




Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
constexpr ll INF = LLONG_MAX;
constexpr double DINF = DBL_MAX;
constexpr ll mod = 1e9+7;
constexpr double PI = M_PI;

template<typename T>
vector<T> make_v(size_t a){
  return vector<T>(a);
}
 
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main(){
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
 
  long long a, b, c;
  cin >> a >> b >> c;
  if(a + b + c <= 21){
    cout << "win\n";
  }else{
    cout << "bust\n";
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
ls = [(0, 0, 0)]
for x in range(n):
    a, b, c = map(int, input().split())
    ls.append((a, b, c))
 
dpa = 0
dpb = 0
dpc = 0
    
for i in range(1, n+1):
    a, b, c = ls[i]
    dpa, dpb, dpc = max(dpb+a, dpc+a), max(dpa+b, dpc+b), max(dpa+c, dpb+c)

print(max(dpa, dpb, dpc))

Measured memory_bytes: 20540
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	string s;
	cin>>s;
	string t;
	cin>>t;
	int q;
	cin>>q;
	vint x(s.size());
	vint y(t.size());
	int cnt = 0;
	rep(i,s.size()){
		if(s[i] == 'A') cnt++;
		else cnt+=2;
		x[i] = cnt;
	}
	cnt = 0;
	rep(i,t.size()){
		if(t[i] == 'A') cnt++;
		else cnt+=2;
		y[i] = cnt;
	}
	rep(_, q){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		a--,b--,c--,d--;
		// cout<<s.substr(a, b-a+1)<<" ";
		// cout<<t.substr(c, d-c+1)<<endl;
		int aa = x[b];
		if(a) aa -= x[a-1];
		int cc = y[d];
		if(c) cc -= y[c-1];
		// cout<<aa<<" "<<cc<<endl;
		if(abs(aa-cc)%3==0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

bool check(string s,int i){
    
    for(int j = 0; j < s.size() - i; j++){
        if(s[j] != s[0]) return false;
    }
    
    return true;
}

int main(void){
    
    string s;
    cin >> s;
    
    int result = s.size();
    
    for(char c = 'a'; c <= 'z'; c++){
        string t;
        t = s;
        
        for(int i = 0; i < t.size(); i++){
            if(check(t,i)){
                result = min(result,i);
            }else{
                
                string t_ = t;
                
                for(int j = 0; j < t.size()-1; j++){
                    if(t[j] == c || t[j+1] == c){
                        t_[j] = c;
                    }else{
                        t_[j] = t[j];
                    }
                }
                
                t = t_;
                
            }
        }
        
    }
    
    cout << result << endl;
    
    
}


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


int main(){
	//freopen("input.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  ll n,m;
  cin>>n>>m;
  string a;
  ll b;
  ll ans1=0; ll ans2=0;
  vector <int> loll (n+1,0);
  for(ll i=0; i<m; i++){
    cin>>b>>a;
    if(a=="AC"){
      if(loll[b]==0){
        ans1++;
        loll[b]=-1;
      }else if(loll[b]>0){
        ans2+=loll[b];
        ans1++;
        loll[b]=-1;
      }
      
    }else{
      if(loll[b]==0){
        loll[b]++;
      }else if(loll[b]>0){
        loll[b]++;
      }
    }
    
}
cout<<ans1<<" "<<ans2;
}

Measured memory_bytes: 640
#include <iostream>
#include <map>
#include <string>
using namespace std;
#define FIN(V) cout<<V<<endl
int main(void){
	map<string, int> map;
	int n;
	char c;
	string s;
	while(cin >> n >> c >> s){
		map[s]++;
	}
	FIN(map["A"]);
	FIN(map["B"]);
	FIN(map["AB"]);
	FIN(map["O"]);
}

Measured memory_bytes: 1208
MOD = 998244353
MAX = int(2e5 + 5)

fact = [0] * MAX
invFact = [0] * MAX


def bigmod(a, b):
	if b == 0:
		return 1
	ret = bigmod(a, b // 2)
	ret = (ret * ret) % MOD
	if b % 2 == 1:
		ret = (ret * a) % MOD
	return ret


def mod_inverse(a):
	return bigmod(a, MOD - 2)


def pre():
	global fact, invFact
	fact[0] = 1
	for i in range(1, MAX):
		fact[i] = (fact[i - 1] * i) % MOD
	invFact[MAX - 1] = mod_inverse(fact[MAX - 1])
	for i in range(MAX - 2, -1, -1):
		invFact[i] = (invFact[i + 1] * (i + 1)) % MOD


def ncr(nn, rr):
	if nn < 0 or nn < rr or rr < 0:
		return 0
	return (fact[nn] * invFact[rr] * invFact[nn - rr]) % MOD



pre()
n, m, k = map(int, input().split())


ans = 0
for i in range(k + 1):
	ans = (ans + m * bigmod(m - 1, n - 1 - i) * ncr(n - 1, i) ) % MOD

print(ans)


Measured memory_bytes: 24636
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

vector<int> z_function (vector<int> &s) {
	int n = s.size();
	vector<int> z(n);
	for (int i = 1, x = 0, y = 0; i < n; i++) {
		z[i] = max(0, min(z[i-x], y-i+1));
		while (i+z[i] < n && s[z[i]] == s[i+z[i]]) {
			x = i, y = i+z[i], z[i]++;
		}
	}
	return z;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    fore(i,0,n) cin >> a[i];
    fore(i,0,n) cin >> b[i];

    vector<int> s;
    fore(i,0,n) s.pb(b[i]^b[(i+1)%n]);
    s.pb(-1);
    fore(i,0,n) s.pb(a[i]^a[(i+1)%n]);
    fore(i,0,n) s.pb(a[i]^a[(i+1)%n]);
    vector<int> z = z_function(s);
    fore(i,0,n) {
        if (z[i+n+1] == n) {
            cout << i << " " << (a[i]^b[0]) << endl;
        }
    }
}


Measured memory_bytes: 10348
def palind(LIST, N):
    for i in range(N):
        if LIST[i] != LIST[-1-i]:
            return False
    return True

S = list(input())
n = len(S)
front = S[:((len(S)+1)//2-1)]
flag = palind(S, len(S)) and palind(front, len(front))

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

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

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n;
char s[20];
vector<int> ans;
ll a[5];

int main()
{
    cin >> n >> a[0] >> a[1] >> a[2];
    if(a[0]+a[1]+a[2] > 2){
        for(int i = 1; i <= n; i++){
            scanf("%s", s+1);
            int x = s[1]-'A', y = s[2]-'A';
            if(a[x] == 0 && a[y] == 0){
                puts("No");
                return 0;
            }
            ans.push_back(a[x] > a[y]?y:x);
            if(a[x] > a[y]) a[x]--, a[y]++;
            else a[x]++, a[y]--;
        }
    }
    else{
        for(int i = 1; i <= n; i++){
            scanf("%s", s+1);
            int x = s[1]-'A', y = s[2]-'A';
            if(a[x] == 0 && a[y] == 0){
                puts("No");
                return 0;
            }
            if(!a[x]) ans.push_back(x), a[y]--, a[x]++;
            else if(!a[y]) ans.push_back(y), a[x]--, a[y]++;
            else{
                if(i == n){
                    ans.push_back(x);
                    break;
                }
                scanf("%s", s+1);
                int u = s[1]-'A', v = s[2]-'A';
                if(u == x && v == y){
                    ans.push_back(x), ans.push_back(y);
                    i++;
                }
                else{
                    int p;
                    if(u == x || v == x) p = x;
                    else p = y;
                    ans.push_back(p);
                    ans.push_back(u+v-p);
                    a[x+y-p]--, a[u+v-p]++;
                    i++;
                }
            }
        }
    }
    puts("Yes");
    for(int i = 0; i < ans.size(); i++){
        putchar(ans[i]+'A'), puts("");
    }

    return 0;
}

Measured memory_bytes: 3936
import math
A, B, N = map(int, input().split())

def fnc(x):
    return math.floor(A*x*1.0/B) - A*math.floor(x*1.0/B)

if B == 1:
    print(0)
elif N < B:
    print(fnc(N))
else:
    ans = 0
    for i in range(B-1, N+1, B):
        s = fnc(i)
        if s > ans:
            ans = s
    print(ans)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;


int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
 	long int t;
 	cin>>t;

 	map<string,long int> m;

 	while(t--){
 		string x;
 		cin>>x;
 		m[x]++;
 	}  

 	long int maxNum = 0;
 	for(auto ele : m)
 		maxNum = max(maxNum,ele.second);


 	for(auto ele : m)
 		if(ele.second == maxNum)
 			cout<<ele.first<<endl;

   return 0;
}

Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int n;
	string st;
	cin>>n;
	cin>>st;
	for(int i=0;i<st.size();i++)
	{
		int d=st[i];
		d=d+n;
		if(d>90) d=d-26;
		char c=d;
		cout<<c; 
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
# include<stdio.h>

int main()
{
	int x,a,b;
	while(scanf("%d %d %d",&x,&a,&b)!=EOF)
	{
		if(b<=a)
		{
			printf("delicious\n");
		}
		else
		{
			if(b-a<=x)
				printf("safe\n");
			else
				printf("dangerous\n");
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// const ll INF = 1LL <<60;
const int INF = 10000;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

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

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
  int n,k;
  cin>>n>>k;
  int d[k];
  for(int i = 0; i < k; i++) cin>>d[i];
  while(1){
    bool flg = true;
    string s = to_string(n);
    // cout<<s<<endl;
    for(int i = 0; i < s.length(); i++){
      for(int j = 0; j < k; j++){
        if(s[i]-'0'==d[j]) {
          
          flg = false;
          break;
          break;
        }
      }
    }
    if(flg) {
      cout<<n<<endl;
      return 0;
    }
    else{
      n++;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
int a,x,b;
cin>>x>>a>>b;
int m=abs(x-a);
int n=abs(x-b);
if(m<n)
cout<<"A";
else
cout<<"B";
return 0;  
}

Measured memory_bytes: 3536
#include <iostream>
#include <string>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    string s, d = "ACGT";
    int ans = 0, cnt = 0;
    cin >> s;
    s += ";";
    for (int i = 0; i < s.size(); ++i) {
        if (d.find(s.at(i)) != string::npos) ++cnt;
        else {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll a, b; cin >> a >> b;
    rep(n, 1, 10000){
        if(n * 8 / 100 == a and n / 10 == b){
            cout << n << endl;
            return;
        }
    }
    cout << -1 << endl;
}

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

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main(void)
{
    int A, B;
    cin >> A >> B;
    cout << (A+B-3) / (A-1) << endl;
    return 0;
}

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


int main(){
    int n,b;
    int mi=10000000,ma=-1000000;
    long long sum=0;
    cin >> n;
    
    for(int i=0; i<n; i++){
        cin >> b;
        sum+=b;
        mi=min(mi,b);
        ma=max(ma,b);
    }
    cout << mi << " " << ma << " " << sum << endl; 


}


Measured memory_bytes: 3116
#include <stdio.h>
#include <string.h>
int main()
{
	int n, tp=0, hp=0, cmp, i;
	char tstr[101], hstr[101];
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%s %s", tstr, hstr);
		cmp=strcmp(tstr, hstr);
		if(cmp>0){
			tp+=3;
		} else if(cmp<0){
			hp+=3;
		} else {
			tp++;
			hp++;
		}
	}
	printf("%d %d\n", tp, hp);
	return 0;
}

Measured memory_bytes: 604
#include    <iostream>
 
using namespace std;
 
int main() {
    while(1) {
        int i, j;
 
        cin >> i >> j;
        if(i == 0 && j == 0) break;
        if(i < j)   cout << i << ' ' << j << endl;
        else        cout << j << ' ' << i << endl;
    }
 
    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define LOG1(x1,x2) cout << x1 << ": " << x2 << endl;
#define LOG2(x1,x2,y1,y2) cout << x1 << ": " << x2 << " , " << y1 << ": " << y2 << endl;
#define LOG3(x1,x2,y1,y2,z1,z2) cout << x1 << ": " << x2 << " , " << y1 << ": " << y2 << " , " << z1 << ": " << z2 << endl;
typedef unsigned long long ll;
typedef double db;
const int N = 1e5+100;
const int M = 1e5+100;
const db EPS = 1e-9;
using namespace std;

ll S,base;
ll x1,y11,x2,y2,x3,y3;

int main()
{
	scanf("%llu",&S);
	base = sqrt(S); x3 = y3 = 0;
	ll tp1 = base*base, tp2 = base*(base+1ll), tp3 = (base+1ll)*(base+1ll);
	if(tp1 == S){
		x2 = y11 = base;
		x1 = y2 = 0;
	}
	else if(tp2 == S){
		x2 = base; y11 = base+1;
		x1 = y2 = 0;
	}
	else if(S >= tp1 && S <= tp2){
		x2 = base; y11 = base+1ll;
		ll hp = x2*y11-S;
		x1 = hp, y2 = 1ll;
	}
	else if(S >= tp2 && S <= tp3){
		x2 = y11 = base+1ll;
		ll hp = x2*y11-S;
		x1 = hp, y2 = 1ll;
	}
	// ll check = x2*y11-x1*y2;
	// if(check == S) printf("YES\n");
	printf("%llu %llu %llu %llu %llu %llu\n",x1,y11,x2,y2,x3,y3);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define MOD 1000000007

int main(){
	string s;
	cin>>s;
	int n=SZ(s);
	int dp[N+5][2]={0};
	dp[0][0]=1;
	REP(i,n){
		{//a+b=0;
			if(s.at(i)=='0'){
				dp[i+1][0]+=dp[i][0];
				dp[i+1][1]+=dp[i][1];
				dp[i+1][0]%=MOD;
				dp[i+1][1]%=MOD;
			}else{
				dp[i+1][1]+=(dp[i][0]+dp[i][1])%MOD;
			}
		}
		{//a+b=1;
			if(s.at(i)=='0'){
				dp[i+1][1]+=2*dp[i][1]%MOD;
				dp[i+1][1]%=MOD;
			}else{
				dp[i+1][0]+=(dp[i][0]*2%MOD);
				dp[i+1][1]+=dp[i][1]*2%MOD;
				dp[i+1][0]%=MOD;
				dp[i+1][1]%=MOD;
			}
		}
		
	}
	
	int ans=(dp[n][0]+dp[n][1])%MOD;
		OUT(ans);
	
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<int,int> x,pair<int,int> y)
{
    if(x.first<y.first)
        return true;
    else if(x.first==y.first)
        return x.second>y.second;
    else
        return false;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}

void solve()
{   
    int x1,x2,x3,x4,x5;
    cin>>x1>>x2>>x3>>x4>>x5;
    if(x1!=1)
        cout<<1;
    else if(x2!=2)
        cout<<2;
    else if(x3!=3)
        cout<<3;
    else if(x4!=4)
        cout<<4;
    else 
        cout<<5;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class B
{
	public static void Main()	
	{
		int W = GetInt();
		int H = GetInt();
		int N = GetInt();

		int left = 0;
		int right = W;
		int bottom = 0;
		int top = H;
		for(int i = 0; i < N; i++)
		{
			int x = GetInt();
			int y = GetInt();
			switch(GetInt())
			{
				case 1:
					left = Math.Max(left, x);
					break;

				case 2:
					right = Math.Min(right, x);
					break;

				case 3:
					bottom = Math.Max(bottom, y);
					break;

				case 4:
					top = Math.Min(top, y);
					break;

				default:
					break;
			}
		}

		if((left > right) || (bottom > top))
			Console.WriteLine(0);
		else
			Console.WriteLine((right - left) * (top - bottom));
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 13140
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n string
	fmt.Scan(&n)
	var x int
	for _, v := range n {
		temp, _ := strconv.Atoi(string(v))
		x += temp
	}
	if x % 9 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

int roop(int n, int k) {
	int result = 0;
	
	rep(i, n) {
		if (i + k - 1< n) {
			result++;
		}
	}
	return result;
}


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

	int N, K, result;
	cin >> N;
	cin >> K;

	result = roop(N, K);
	cout << result << '\n';
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	N := nextInt(sc)
	C := nextInt(sc)
	K := nextInt(sc)
	T := make([]int, N)
	for i := range T {
		T[i] = nextInt(sc)
	}
	sort.Ints(T)
	var bus, passenger int
	start := T[0]
	for i := 0; i < len(T); i++ {
		passenger++ // 乗客が到着した
		if start == 0 {
			start = T[i]
		}
		if i+1 < len(T) && T[i+1]-start <= K && passenger < C {
			// バスの座席に余裕があり、この乗客は次の乗客を待てる
			continue
		} else {
			// バスが満席かあるいは次の乗客を待てない客がいるのでバスを出発させる
			bus++
			passenger = 0
			start = 0
		}
	}
	fmt.Println(bus)
}


Measured memory_bytes: 2944
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
    String b = sc.next();
    String[] str = {"A","B","C","D","E","F"};
    int[] num = {10,11,12,13,14,15};
    int c = 0;
    int d = 0;
    for (int i =0; i<str.length;i++){
      if (a.equals(str[i])){
        c=num[i];
      }
      if (b.equals(str[i])){
        d=num[i];
      }
    }
    if (c==d){
      System.out.println("=");
    } else if (c>d) {
      System.out.println(">");
    } else {
      System.out.println("<");
    }
  }
}


Measured memory_bytes: 23380
import sys
input = lambda: sys.stdin.readline().rstrip() 
from collections import deque

def resolve():
    H, W = map(int, input().split())
    s = []
    white_num = 0
    for i in range(H):
        s.append(input())
        white_num += s[i].count('.')

    dir = ((0, 1), (1, 0), (0, -1), (-1, 0))
    dist = [[-1]*W for _ in range(H)]
    que = deque()
    que.append((0, 0))
    dist[0][0] = 0

    while len(que)>0:
        now_y, now_x = que.popleft()
        if now_y==H-1 and now_x==W-1:
            break
        for dy, dx in dir:
            next_y = now_y+dy
            next_x = now_x+dx
            if 0<=next_y<H and 0<=next_x<W and s[next_y][next_x]=='.' and dist[next_y][next_x]==-1:
                que.append((next_y, next_x))
                dist[next_y][next_x] = dist[now_y][now_x] + 1

    if dist[H-1][W-1]==-1:
        print(-1)
    else:
        print(white_num-(dist[H-1][W-1]+1))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3436
N, K = map(int, input().split())
L = [0] * N

for k in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for di in range(d):
        L[A[di]-1] += 1

total = 0
for n in range(N):
    if L[n] == 0:
        total += 1

print(total)


Measured memory_bytes: 9192
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function Main(args){
    input = args.split("\n");
    const N = parseInt(input[0]);
    var count = 0;
    var maxCount = 0;
    var result = 1;

    for(var i=1; i<=N; i++){
        count = 0;
        var j = i;
        while(true){
            if(j%2 ==0){
                count++;
                j /= 2;
            }else{
                break;
            }

            if(maxCount < count){
                maxCount = count;
                result = i;
            }
        }
    }

    console.log(result);
}

Measured memory_bytes: 9420
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];
 
 
int main () {
    int N, M;
    cin >> N >> M;

    int s=0;
    rep(i,M){
        int a;
        cin >> a;
        s += a;
    }

    cout << (N-s>=0?N-s:-1) << endl;


}

Measured memory_bytes: 3612
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input1 = Console.ReadLine()
            .Split(' ')
            .Select(n => int.Parse(n))
            .ToArray();
        var numbers = Console.ReadLine()
            .Split(' ')
            .Select(n => int.Parse(n))
            .ToArray();

        var N = input1[0];
        var K = input1[1];

        decimal[] arr = new decimal[N];
        for (int i = 0; i < N; i++)
        {
            var max = numbers[i];
            var sum = 0;
            for (int j = 1; j <= max; j++)
            {
                sum += j;
            }

            var ave = (decimal) sum / (decimal) max;
            arr[i] = ave;
            // Console.WriteLine($"arr[{i}] = {ave} (max={max})({sum} / {max})");
        }

        decimal[] arr2 = new decimal[N + 1];
        arr2[0] = 0;
        for (int i = 0; i < arr.Length; i++)
        {
            arr2[i + 1] = arr2[i] + arr[i];
            // Console.WriteLine($"arr2[{i + 1}] = {arr2[i + 1]}");
        }

        decimal result = 0;
        for (int s = 0; s <= N - K; s++)
        {
            var e = s + K;

            var diff = arr2[e] - arr2[s];

            if (result < diff)
            {
                result = diff;
            }

            // Console.WriteLine($"arr2[{s}]~arr2[{e}] {diff}");
        }

        Console.WriteLine(result);
    }
}

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


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

    string S,T;
    cin >> S >> T;
    int N=S.size();
    bool z=false;
    rep(i,N){
        bool q=true;
        rep(j,N){
            int x=i+j;
            if(x>=N) x=x-N;
            if(S.at(j)!=T.at(x)) q=false;
        }
        if(q) z=true;
    }

    if(z) cout << "Yes"<< endl;
    else cout << "No"<< endl;

}


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

using namespace std;
const int mod = 1e9+7;
int main(){
    long long x,n,i,j,c;
    cin >> x;
    map <long long, long long > fa;
  for( i = 1; i <= x; i++){n=i;
        for( j = 2; j*j <=n; j++){
            while(n%j == 0){
                n=n/j;
                fa[j]++;}}

        if(n!= 1){
            fa[n]++;}}
    c = 1;
    map < long long,long long > :: iterator it = fa.begin();
    for(; it != fa.end(); it++){
        c = (c * ((it)->second + 1)) % mod;
        c %= mod;

    }
    cout << c << endl;
}




Measured memory_bytes: 3584
x, y, z, k = list(map(int, input().split()))
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))

ab = sorted(x+y for x in a for y in b)[:-k-1:-1]
abc = sorted(x+y for x in ab[:k] for y in c)[:-k-1:-1]
print(*abc, sep='\n')

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

int main()
{
    int sum=0;
    int a,b;
    cin >> a >> b;
    if(a>b)
        sum+=b;
    else
        sum+=a;
    cin >> a >> b;
    if(a>b)
        sum+=b;
    else
        sum+=a;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args []) {
		Scanner scan = new Scanner(System.in);
			
		int n, q, com, x, y, sum;
			
		n = scan.nextInt();
		q = scan.nextInt();
			
		int a[] = new int[n];
			
		for(int i = 0; i < n; i++) {
			a[i] = 0; 
		}
			
		for(int i = 0; i < q; i++) {
			com = scan.nextInt();
			x = scan.nextInt();
			y = scan.nextInt();
			
			if(com == 0) { //add
				a[x - 1] += y;
				
			} else if (com == 1) { //sum
				sum = 0;
				
				for(int j = x - 1; j < y; j++) {
					sum += a[j];
				}
					
				System.out.println(sum);
			}
		}
		
		scan.close();
	}
}

Measured memory_bytes: 101636
S = input()

A = int(S[:2])
B = int(S[2:])

if 0 < A <= 12 and 0 < B <= 12:
    print('AMBIGUOUS')
elif 0 < A <= 12 and B >= 0:
    print('MMYY')
elif 0 < B <= 12 and A >= 0:
    print('YYMM')
else:
    print('NA')


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

int main() {
	int n;
	long int sum = 0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	sort(a.begin(), a.end());
	cout << a[0] << " " << a[n - 1] << " " << sum << endl;
	return 0;
}


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

#define ll long long
#define vec vector<ll>
#define sortv(a); sort(a.begin(), a.end());
#define rev(a); reverse(a.begin(), a.end());
#define FOR(i,a,b) for (ll i = (ll)(a); i < (b); i++)
#define ROF(i,a,b) for (ll i = (ll)(b)-1; i >= (a); i--)

ll MOD = 1000000007;
ll INF = 1LL << 60;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n,m;cin>>n>>m;
	int out = (n*(n-1))/2 + (m*(m-1))/2;
	cout<<out;
}

Measured memory_bytes: 256
import numpy as np

N = int(input())
a = np.array(list(map(int,input().split())))
count = 0
flag = 0
while True:
    for i in range(N):
        if a[i]%2 == 1:
            flag = 1
            continue;
    if flag == 1:
        break;
    else:
        count += 1
        a = a/2
print(count)


Measured memory_bytes: 12392
#include <iostream>
using namespace std;
int main () {
	int n, m;
	cin>>n>>m;
	int a[n][m], b[m], c[n]={0};
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++) 
		cin>>a[i][j];
	}
	for(int k=0;k<m;k++)
	cin>>b[k];
	for(int l=0;l<n;l++){
		for(int x=0;x<m;x++)
		c[l]+=a[l][x]*b[x];
		cout<<c[l]<<endl;
	}
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;


int main(){
  int a,b;
  cin >> a >>b;
  int ans=0;
  for(int i=1;i<13;i++){
    if(i<a){ans++;}else if(i<=a && i<=b){ans++;}
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;

	int len = 0;
	for (int i = 0; i <= n; i++) {
		if (s.substr(n - i, i) == t.substr(0, i)) len = i;
	}

	cout << 2 * n - len << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b,x,y,r;
    scanf("%d %d %d %d %d",&a,&b,&x,&y,&r);
    if((x-r)>=0&&(y-r>=0&&(x+r)<=a&&(y+r)<=b)){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}



Measured memory_bytes: 2120
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define REP(i, n) for (size_t i = 0; i < (n); i++)
#define nvec(T, v, n) vector<T> v(n); REP(i, n) {cin>>(v)[i];}
#define npairs(T1, T2, v, n) vector<pair<T1, T2>> v(n); REP(i, n){cin>>v[i].first>>v[i].second;}
#define ntuples(T1, T2, T3, v, n) vector<tuple<T1, T2, T3>> v(n); REP(i, n){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t( min_element(all(v)) - (v).begin() )
#define max_index(v) size_t( max_element(all(v)) - (v).begin() )
#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define count_le(v, a) size_t( upper_bound(ALL(v), a) - (v).begin() )
#define count_lt(v, a) size_t( lower_bound(ALL(v), a) - (v).begin() )
#define count_ge(v, a) size_t( (v).end() - lower_bound(ALL(v), a) )
#define count_gt(v, a) size_t( (v).end() - upper_bound(ALL(v), a) )

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))

#define GCD(v) gcd(ALL(v), 0l)

/*template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    return gcd(b%a, a);
}
template <typename InputItr, typename T>
T gcd(InputItr first, InputItr last, T init) {
    for (; first != last; ++first) init = gcd(init, *first);
    return init;
}*/

template <typename T>
using vec = vector<T>;

template <typename T>
using vvec = vector<vector<T>>;

int main(){
  int x;
  cin>>x;
  if(x>=30) cout<<"Yes"; else cout<<"No";

}


/* きょむ〜 */


Measured memory_bytes: 3632
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n,k;
    R(n,k);
    VI a(n+1);
    FOR(i,1,n)R(a[i]);
    FOR(i,2,n)a[i]+=a[i-1];
    int ma=0;
    FOR(i,k,n){
        ma=max(ma,a[i]-a[i-k]);
    }
    W((ma+k)*0.5);
    return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
#define pb push_back
#define eb emplace_back
int main()
{
    ll n;

    cin>>n;

    ll s=7;

    for(ll i=1;i<=1e6;i++)
    {
        if(s%n==0)
        {
            cout<<i<<endl;
            return 0;
        }

        s=s*10+7;

        s=s%n;

    }
    cout<<-1<<endl;


}


Measured memory_bytes: 3676
s = int(input())

ans = [s]

while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    if ans.count(s) != 0:
        ans.append(s)
        break
    else:
        ans.append(s)


print(len(ans))


Measured memory_bytes: 9040
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
last = a[0]
ans=0
for i in a:
  ans+= b[i-1]
  
  if i-last==1:
    ans += c[last-1]
  last = i
print(ans)

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int X, N; cin >> X >> N;
    vector<int> A(110, 0);
    for (int i = 0; i < N; i++) {
        int x; cin >> x; A[x]++;
    }
    pair<int, int> Ans = {200, 200};
    for (int i = 0; i < 110; i++) {
        if (!A[i]) Ans = min(Ans, {abs(X-i), i});
    }
    cout << Ans.second << "\n";
    return 0;
}

Measured memory_bytes: 3628