akhauriyash/Code-Regression huggingface dataset:
/*
[abc168] C - : (Colon)
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

double A, B, H, M;

double solve() {
    double al = 2.0 * M_PI * (H * 60 + M) / 720.0;
    double be = 2.0 * M_PI * M / 60.0;
    double th = abs(al - be);

    cerr << al << ", " << be << endl;

    double ans = sqrt(A * A + B * B - 2 * A * B * cos(th));
    return ans;
}

int main() {
    cin >> A >> B >> H >> M;

    cout << setprecision(20) << solve() << endl;

    return 0;
}


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


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

int main(){
    int n; cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    set<string> set;
    rep(i,n) {
        set.insert(s[i]);
    }
    cout << set.size() << endl;
}

Measured memory_bytes: 25140
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=n1;i<(int)(n2);i++)
using namespace std;

signed main()
{
	int N;
	cin >> N;
	vector<int> H(N);
	Rep(i, N){
		cin >> H[i];
	}

	int max = 0;
	int cand = 0;
	Rep(i, N-1){
		if(H[i] >= H[i+1]){
			cand++;
		}else{
			if(cand > max) max = cand;
			cand = 0;
		}
	}
	if(cand > max) max = cand;
	cout << max;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T> 
void remdup(vector<T>& v) {												
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/o_o/MyCodes/pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  


void solve(){
	int n ;re(n);
	auto div = [&](int a ){
		vi ret ;
		int i;
		for(i = 1 ; i*i < a ; ++i){
			if(a%i==0) ret.pb(a/i), ret.pb(i);
		}
		if(i*i==a ) ret.pb(i);
		sort(all(ret));
		return ret; 
	};
	int ans = 0 ;
	trav(d,div(n)){
		if(d==1) continue;
		int tmp = n ; 
		while(tmp%d==0){
			tmp/=d;
		}
		ans+=(tmp%d==1);
	}
	ans+=sz(div(n-1))-1; 
	cout << ans << endl; 
}
signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













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


Measured memory_bytes: 3664
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
#include <iomanip>
using namespace std;
typedef long long ll;

int Tmax, V, E, u, v, d,f[444], Nnew,Nput,Nachieve,trush, new_id, dst,order[11111],check[444],par[444],sum=0;
char s[3];
vector<vector<pair<int, int>>> li(444);
queue<pair<int,int>> route;

void dfs(int now,int distance) {
	route.push(make_pair(now,distance));
	sum += distance * 2;
	for (auto &e : li[now]) {
		if (par[e.first] == now) {
			dfs(e.first, e.second);
			route.push(make_pair(now, e.second));
		}
	}
}

int main() {
	cin >> V >> E;
	for (int i = 0; i < E; i++) {
		cin >> u >> v >> d;
		li[u].push_back(make_pair(v, d));
		li[v].push_back(make_pair(u, d));
	}
	for (int i = 1; i <= V; i++)
		cin >> f[i];
	cin >> Tmax;
	for (int i = 1; i <= V; i++)
		check[i] = 0;
	priority_queue<pair<pair<int, int>,int>,vector<pair<pair<int, int>,int>>,greater<pair<pair<int, int>, int >>> que;
	que.push(make_pair(make_pair(0, 1),-1));
	while (!que.empty()) {
		int now = que.top().first.second, npar=que.top().second;
		que.pop();
		if (!check[now]) {
			check[now]++;
			par[now] = npar;
			for (auto &e : li[now]) {
				int next = e.first, dnext = e.second;
				if (!check[next])
					que.push(make_pair(make_pair(dnext, next), now));
			}
		}
	}
	dfs(1,0);
	route.pop();
	int count = 0,ndst,i=0;
	if (sum < Tmax) {
		for (; i < Tmax%sum; i++) {
			cin >> Nnew;
			if (Nnew)
				cin >> new_id >> order[i];
			else
				order[i] = -1;
			cin >> Nput;
			for (int j = 0; j < Nput; j++)
				cin >> trush;
			cout << "-1" << endl;
			cin >> s >> Nachieve;
			for (int j = 0; j < Nachieve; j++)
				cin >> trush;
		}
	}
	for (; i < Tmax; i++) {
		cin >> Nnew;
		if (Nnew)
			cin >> new_id >> order[i];
		else
			order[i] = -1;
		cin >> Nput;
		for (int j = 0; j < Nput; j++)
			cin >> trush;
		if (!count) {
			ndst = route.front().first;
			count = route.front().second;
			route.pop();
			route.push(make_pair(ndst, count));
		}
		cout << ndst << endl;
		count--;
		cin >> s >> Nachieve;
		for (int j = 0; j < Nachieve; j++)
			cin >> trush;
	}
}


Measured memory_bytes: 1364
S = input()
K = int(input())

N = len(S)
Q = set()
for i in range(N):
    Q.add(S[i])
    if i<N-1:Q.add(S[i:i+2])
    if i<N-2:Q.add(S[i:i+3])
    if i<N-3:Q.add(S[i:i+4])
    if i<N-4:Q.add(S[i:i+5])
Q = sorted(list(Q))
print(Q[K-1])

Measured memory_bytes: 4592
n = input()
try:
    n = int(n)
    
    v = [int(x) for x in input().split(' ')]
    
    sum = 0
    for i in range(len(v)):        
        sum += 1/v[i]
        
    sum = 1 / sum
    print(sum)

    
except ValueError:
    print("数値を入力してください")

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

typedef long long ll;

int main() {
   int n;
   cin >> n;
   int ans = 0;
   for (int i = 0; i < n; ++i) {
	   int x, y;
	   cin >> x >> y;
	   ans += y - x + 1;
   }
   cout << ans;
}



















Measured memory_bytes: 256
s = input()
l = len(s)
n = int(s)
ans = 0
import itertools
for li in range(3, l+1):
    for i in itertools.product([7, 5, 3], repeat=li):
        if len(set(i)) != 3:
            continue
        num = int(''.join(map(str, i)))
        if num <= n:
            ans += 1

print(ans)

Measured memory_bytes: 3060
n,m=map(int,input().split())
l,r=1,n
for i in range(m):
    x,y=map(int,input().split())
    if l<x:
        l=x
    if y<r:
        r=y
    if l>r:
        print(0)
        break
else:
    print(r-l+1)


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

int main() {
  int k;
  
  cin >> k;
  
  if (k == 1||k == 2||k == 3||k == 5||k == 7||k == 11||k == 13||k == 15||k == 17||k == 19||k == 23||k == 29||k == 31){
    cout << 1 << endl;
    
  }
  else if (k == 28||k == 30){
      cout << 4 << endl;
  }
  else if (k == 8||k == 12||k == 18||k == 20||k == 27){
      cout << 5 << endl;
  }
  else if (k == 16){
      cout << 14 << endl;
  }
  else if (k == 24){
      cout << 15 << endl;
  }
  else if (k == 32){
      cout << 51 << endl;
  }
  else { 
    cout << 2 << endl;
       }
}



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


#define ll long long
#define ld long double
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back


using namespace std;

const int INF = 2e9;
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int n, m;
int a[301][301];



bool check(int cnt) {
    queue<int> d[n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            d[i].push(a[i][j]);
        }
    }
    int cntd[301];
    bool bad[301];
    for (int i = 0; i < 301; i++)
        bad[i] = false;
    while (true) {
        for (int i = 0; i < 301; i++)
            cntd[i] = 0;
        for (int i = 0; i < n; i++) {
            if (d[i].empty()) {
                return false;
            }
            cntd[d[i].front()]++;
        }
        int k = -1;
        for (int i = 0; i < 301; i++) {
            if (cntd[i] > cnt) {
                k = i;
            }
        }
        if (k == -1) {
            return true;
        } else {
            bad[k] = true;
        }
        for (int i = 0; i < n; i++) {
            while (bad[d[i].front()]) {
                d[i].pop();
                if (d[i].empty()) {
                    return false;
                }
            }
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef NICK
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
#endif
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) 
            cin >> a[i][j];
    }
    int l = 0;
    int r = max(n, m) + 10;
    while (l < r - 1) {
        int cnt = (l + r) / 2;
        if (check(cnt)) {
            r = cnt;
        } else {
            l = cnt;
        }
    }
    if (check(l)) {
        cout << l << "\n";
    } else if (check(r)) {
        cout << r << "\n";
    }
    return 0;
}           
            








Measured memory_bytes: 1176
#include <iostream>

using namespace std;

int main(void) {
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	int x, max_x, y, min_y;
	for (int i = 0; i < N; i++) {
		cin >> x;
		if (i == 0) max_x = x;
		if (x > max_x) max_x = x;
	}
	for (int i = 0; i < M; i++) {
		cin >> y;
		if (i == 0) min_y = y;
		if (y < min_y) min_y = y;
	}

	if (max_x < min_y && max_x < Y && X < min_y) cout << "No War" << endl;
	else cout << "War" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void) 
{
	int N, H, W, A[1000], B[1000];
	int i,cnt=0;
	cin >> N >> H >> W;
	for (i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
		if (A[i] >= H && B[i] >= W) {
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,x=0;
  cin>>A>>B>>C;
  for(int i=1;i<=B;i++){
    if(A*i%B==C) x=1;
  }
  cout<<(x?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	while(cin>>n,n) 
	{
		int dp[n][n];
		char f[n][n];
		int ans=0;
		memset(dp,-1,sizeof(dp));
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				cin>>f[i][j];
				if(i==0||j==0)
				{
					if(f[i][j]=='*') dp[i][j]=0;
					else dp[i][j]=1;
				}
			}
		}
		
		for(int i = 1; i < n; ++i)
		{
			for(int j = 1; j < n; ++j)
			{
				if(f[i][j]=='*') dp[i][j]=0;
				else
				{
					dp[i][j]=min(dp[i][j-1],min(dp[i-1][j-1],dp[i-1][j]))+1;
					ans=max(ans,dp[i][j]);
				}
			}
		}
		cout<<ans<<endl;
	}
  return 0;
}

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

int main () {
  int N , M ;
  cin >> N >> M ;
  vector<int> line(M) ;
  
  for(int i = 0 ; i < M ; i++ ) {
    cin >> line[i] ;
  }
  sort(line.begin(),line.end()) ;
  
  vector<int> num(M);
  
  for(int i = 0 ; i < M - 1 ; i++){
    num[i] = line[i + 1] - line[ i ] ;
  }
  sort(num.begin(),num.end()) ;
  
  int ans = 0 ;
  
  for(int i = 0 ; i < M - ( N - 1 ) ; i++ ) {
    ans += num[i] ;
  }
  
  cout << ans << endl ;
  
}


Measured memory_bytes: 1024
function Main(input){
    const arr = input.trim().split('\n')[1].split(' ').map(BigInt);

    let count = 1n;
    if(arr.includes(0n) >0){
        console.log(0);
        return;
    }
    for(let num of arr){
        count *= num;
        if(count > BigInt(1000000000000000000)){
            console.log(-1);
            return;
        }
    }    
    console.log(count.toString());
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 44052
#include <cstdio>
#include <algorithm>
#include <bitset>

using namespace std;

int R, C;
int MAX = 0;
bitset<10001> pai[11];

void solve(int r){
	if(r == R) return;
	int cnt = 0;
	for(int i = 0; i < C; ++i){
		int temp = 0;
		for(int j = 0; j < R; ++j){
			temp += pai[j][i];
		}
		cnt += max(temp, R - temp);
	}
	MAX = max(MAX, cnt);
	
	solve(r + 1);
	
	pai[r].flip();
	solve(r + 1);
	pai[r].flip();
}

int main(){
	while(scanf("%d%d", &R, &C) == 2 && R && C){
		for(int i = 0; i < R; ++i){
			for(int j = 0; j < C; ++j){
				int d; scanf("%d", &d);
				pai[i][j] = d;
			}
		}
	
		MAX = 0;
		solve(0);
		printf("%d\n", MAX);
	}
}


Measured memory_bytes: 2576
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
LL gcd(LL a, LL b){
	return (b == 0) ? a : gcd(b, a%b);
}
int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	LL n;
	cin>>n;
	VL arr(n);
	rep(i,0,n){
		cin>>arr[i];
	}
	sort(ALL(arr));
	LL g = gcd(arr[1], arr[0]);
	rep(i,2,n){
		if(g >= arr[i])
			g = gcd(g, arr[i]);
		else
			g = gcd(arr[i], g);
	}
	cout<<g;
  	return 0;
}

Measured memory_bytes: 4012
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend() 
#define pb push_back
#define fastIO(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

int n,a,b;

int main () {
	fastIO();
	cin >> n >> a >> b;
	if((a-b-1) % 2)
		cout << "Alice\n";
	else
		cout << "Borys\n";
	return 0;
}


Measured memory_bytes: 256
n = input()
k = int(input())
 
dp = [[0] * (k + 2) for _ in range(2)]
dp[0][0] = 1
 
for d in n:
    ndp = [[0] * (k + 2) for _ in range(2)]
    for i in range(k + 1):
        ndp[1][i] += dp[1][i]
        ndp[1][i + 1] += dp[1][i] * 9
        if d == '0':
            ndp[0][i] += dp[0][i]
        else:
            ndp[1][i] += dp[0][i]
            ndp[1][i + 1] += dp[0][i] * (int(d) - 1)
            ndp[0][i + 1] += dp[0][i]
    dp = ndp
print(dp[0][k] + dp[1][k])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#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 REP(i, k, n) for(int i=(int)(k); i<(int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const int INF = INT_MAX;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x, ll y){ if(x>y) swap(x, y);while(x!=0){ y%=x; swap(x, y); }return y; }
ll mpow(ll x, ll r){if(r==0) return 1;if(r%2==1){ return x*mpow(x, r-1)%mod; }else{ ll aa = mpow(x, r/2); return aa*aa%mod; }}

int main(){
	ll N, X, D; cin >> N >> X >> D;
	if(X==0){
		if(D==0) cout << 1 << endl;
		else cout << 1+(N*(N-1))/2 << endl;
		return 0;
	}
	if(D==0){
		cout << N+1 << endl;
		return 0;
	}
	ll g = gcd(abs(X), abs(D));
	X /= g; D /= g;
	ll pat;
	if(abs(D)%2==0) pat = abs(D)/2;
	else pat = abs(D);
	chmin(pat, N);
	vector<P> a[pat][2];
	vector<bool> used(pat, false);
	vector<ll> c(pat);
	ll tot = N*(N-1)/2, m = 0;
	rep(i, N+1){
		if(i==0){
			a[m][tot%2].pb(P(-tot, -tot));
			used[m] = true;
			c[m] = -N;
		}else if(i==N){
			if(!used[m]){
				a[m][tot%2].pb(P(tot, tot));
			}else{
				ll p = ((N - c[m])*X)/D;
				a[m][abs(tot+p)%2].pb(P(tot+p, tot+p));
			}
		}else{
			ll mi, ma;
			mi = (ll)(i-1)*i - tot, ma = (2*N-1-i)*i - tot;
			if(!used[m]){
				a[m][abs(mi)%2].pb(P(mi, ma));
				used[m] = true;
				c[m] = 2*i-N;
			}else{
				ll p = (((2*i-N) - c[m])*X)/D;
				a[m][abs(mi+p)%2].pb(P(mi+p, ma+p));
			}
		}
		m = (m+1)%pat;
	}
	ll ans = 0;
	rep(i, pat)rep(x, 2){
		sort(all(a[i][x]));
		ll r;
		rep(j, a[i][x].size()){
			ll f = a[i][x][j].first, s = a[i][x][j].second;
			if(j==0){
				r = s;
				ans += (s - f)/2 + 1;
			}else{
				if(f > r){
					r = s;
					ans += (s - f)/2 + 1;
				}else if(s > r){
					ans += (s - r)/2;
					r = s;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 17408
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define NIL NULL

typedef struct node{
  struct node *parent, *left, *right;
  int key;
}*N;

N root = NIL;

void insert(int);
N find(N, int);
void inorder(N);
void preorder(N);

int main(){
  int m, i, k;
  char str[256];

  scanf("%d", &m);

  for(i = 0; i < m; i++){
    scanf("%s", str);
    if(strcmp(str, "insert") == 0){
      scanf("%d", &k);
      insert(k);
    }else if(strcmp(str, "print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(strcmp(str, "find") == 0){
      scanf("%d", &k);
      if(find(root, k) != NIL)   printf("yes\n");
      else                                printf("no\n");
    }  
  }
    
  return 0;
}

void insert(int v){
  N y = NIL, x = root, z;
  
  z = malloc(sizeof(struct node));
  z->key = v;
  z->left = z-> right = NIL;
  
  while(x != NIL){
    y = x;
    if(z->key < x->key)   x = x->left;
    else                           x = x->right;
  }

  z->parent = y;

  if(y == NIL)  root = z;
  else if(z->key < y->key)   y->left = z;
  else                                   y->right = z;
}

N find(N u, int k){
  while(u != NIL && k != u->key){
    if(k< u->key)   u = u->left;
    else                  u = u->right;
  }
    return u;
}

void inorder(N u){
  if(u == NIL)   return;
  inorder(u->left);
  printf(" %d",  u->key);
  inorder(u->right);
}

void preorder(N u){
  if(u == NIL)   return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}
	

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

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "sort"
#define pll pair<ll, ll>
#define pii pair<ll, pll>
#define fi first
#define se second
using namespace std;
const ll mod = 1e9 + 7;
const ll N = 1e6 + 5;
const ll mxn = 2e5 + 5;
pll p[N];
//vector<pll> adj[N], adt[N];
vector<pll> kq;
struct dang
{
    ll vl, id, node;
} ;
priority_queue< pll, vector<pll>, greater<pll> > pr, prn;
ll n, m, t, k, T, ans, tong, a[N], d[N], b[N], c[N];

ll pw(ll a, ll b)
{
    ll tt = 1;
    for( ;b > 0; b >>= 1)
    {
        if(b & 1)tt = (tt * a) % mod;
        a = (a * a) % mod;
    }
    return tt;
}
ll sl(ll u, ll v)
{
    return (a[u] * b[v] % mod * b[u-v] % mod) % mod;
}
inline void sol()
{
    cin >> n;
    c[0] = 1;
    ans = 1;
    a[0] = 1;
    b[0] = 1;
    for(int i = 1; i <= n; i ++)
    {
        a[i] = (a[i-1] * i) % mod;
        b[i] = pw(i, mod-2);
        b[i] = (b[i-1] * b[i]) % mod;
        ans = (ans * 10) % mod;
        c[i] = (c[i-1] * 8) % mod;
    }
    ans = (ans - c[n] + mod) % mod;
    for(int i = 1; i <= n; i ++)
    {
        ans = (ans - 2 * c[n-i] * sl(n, i) % mod + mod) % mod;

    }
    cout << ans;
}
int main()
{
    if(fopen(task".in", "r")){
       freopen(task".in", "r", stdin);
       freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    sol();
}


Measured memory_bytes: 26984
#include<stdio.h>
int main(){
  int a[100][100],b[1000];
  int n,m,i,j,c=0;
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&a[i][j]);
    }
  }
  for(j=0;j<m;j++){
scanf("%d",&b[j]);
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c+=a[i][j]*b[j];
    }
   printf("%d\n",c);
   c=0;

  }  
return 0;
}

Measured memory_bytes: 640
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> L,R,d;


  return R/d - (L-1)/d;
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}


Measured memory_bytes: 3560
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
int a[100000];
int main(){
	int a[20],l,set=0;
	while(true){
	cin>>a[0]>>l;
	if(a[0]==0&&l==0)
		break;
	int count=1;
	while(true){
		int m[6];
		for(int i=0;i<l;i++){
			int r=pow(10,i+0.0);
			m[i]=a[count-1]/r%10;
		}
		sort(m,m+l);
		int big=0;
		for(int i=0;i<l;i++)
			big+=pow(10.0,i+0.0)*m[i];
		int small=0;
		for(int i=0;i<l;i++)
			small+=pow(10.0,l-i-1.0)*m[i];
		a[count]=big-small;
		bool t=false;
		for(int j=0;j<count;j++){
			if(a[count]==a[j]){
				t=true;
				set=j;
			}
		}
		if(t==true)
			break;
		count++;
	}
	cout<<set<<" "<<a[count]<<" "<<count-set<<endl;
	}
    return 0;
}

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

int main() {
	long long int x, y;
	cin >> x >> y;
	if(x * y == 0){
		if(x == 0){
			if(y > 0){
				cout << y << endl;
			}
			else{
				cout << abs(y) + 1 << endl;
			}
		}
		else{
			if(x > 0){
				cout << x + 1 << endl;
			}
			else{
				cout << abs(x) << endl;
			}
		}
	}
	else if(x > -1 && y > -1){
		if(x < y){
			cout << y - x << endl;
			return 0;
		}
		else{
			cout << x - y + 2 << endl;
			return 0;
		}
	}
	else if(x < 1 && y < 1){
		if(x < y){
			cout << y - x << endl;
			return 0;
		}
		else{
			cout << x - y + 2 << endl;
			return 0;
		}
	}
	else{
		if(x > y){
			cout << abs(x - abs(y)) + 1 << endl;
			return 0;
		}
		else{
			cout << abs(y - abs(x)) + 1 << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
    
public class Main {
        
      
    public static void main(String[] args) {
             
          try {
                  
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
            String s = null;
            String now = "A";
             
            while((s = br.readLine())!=null){
             StringTokenizer st = new StringTokenizer(s,",");
             String first = st.nextToken();
             String second = st.nextToken();
             if(now.equals(first))
             {
                 now = second;
                  
             }
             else if(now.equals(second))
             {
                 now = first;   
             }
             
            }
            System.out.println(now);
          }catch (Exception e) {
              e.printStackTrace();
            }
        }
       
}
    

Measured memory_bytes: 24092
#include<iostream>
using namespace std;
int main(){
	int h,w;
for(;;){
	cin>>h>>w;
    if(h==0||w==0){
		   break;
	}
	for(int j=1;j<=h;j++){
	for(int i=1;i<=w;i++){
		if(j==1||j==h||i==1||i==w){
			cout<<"#";
		}else{
			cout<<".";
		}
	}
	cout<<endl;
	}
	cout<<endl;
}
}

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

int main(){
    int h, w;
    
    while(1){
        cin >> h >> w;
        
        if(h == 0){
            break;
        }
        
        int i;
        for(i = 0; i < w; i++){
            cout << "#";
        }
        
        cout << endl;
        
        int j;
        for(i = 0; i < h - 2; i++){
            for(j = 0; j < w; j++){
                if(j == 0 || j == w - 1){
                    cout << "#";
                }
                else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        
        for(i = 0; i < w; i++){
            cout << "#";
        }
        
        cout << endl;
        cout << endl;
    }
}


Measured memory_bytes: 3092
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int k,s,i,j,sum,ans;
    int a[1000000];
    scanf("%d%d",&k,&s);
    for(i=0; i<=k; ++i)
    {
        for(j=0; j<=k; ++j)
            a[5000+i+j]++;
    }
    sum=0;
    for(i=0; i<=k; ++i)
    {
        ans=s-i;
        if(ans<0) continue;
        sum=sum+a[5000+ans];
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <deque>
#include <cstdio>

using namespace std;

int main(){
    int m, d; cin >> m >> d;
    int ans=0;
    for(int j=1; j<=m; ++j){
        for(int i=1; i<=d; ++i){
            int d1=i%10;
            int d10=i/10;
            if(d1<2 || d10<2) continue;
            if(j==d1*d10) ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
p,t=[int(input())for i in range(2)]
tg=[int(s)for s in input().split(" ")]
pts=[0 for i in range(p)]
for i in range(t):
    ex=[int(s)for s in input().split(" ")]
    c_wr=0
    for j in range(p):
        if ex[j]==tg[i]:pts[j]+=1
        else:c_wr+=1
    pts[tg[i]-1]+=c_wr
for pt in pts:print(pt)

Measured memory_bytes: 7704
n, m = map(int, input().split())
py = [list(map(int, input().split())) for i in range(m)]

for i in range(m):
    py[i].append(i)

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

box = []

count = 1
pref = -1
for i in range(m):
    if pref == py[i][0]:
        count += 1
        box.append((pref, count, py[i][2]))
    else:
        pref = py[i][0]
        count = 1
        box.append((pref, count, py[i][2]))

box.sort(key=lambda x: x[2])


for p, c, i in box:
    ans = ""
    if p < 10:
        ans += "00000"
        ans += str(p)
    elif p < 100:
        ans += "0000"
        ans += str(p)
    elif p < 1000:
        ans += "000"
        ans += str(p)
    elif p < 10000:
        ans += "00"
        ans += str(p)
    elif p < 100000:
        ans += "0"
        ans += str(p)
    else:
        ans += str(p)

    if c < 10:
        ans += "00000"
        ans += str(c)
    elif c < 100:
        ans += "0000"
        ans += str(c)
    elif c < 1000:
        ans += "000"
        ans += str(c)
    elif c < 10000:
        ans += "00"
        ans += str(c)
    elif c < 100000:
        ans += "0"
        ans += str(c)
    else:
        ans += str(c)

    print(ans)

Measured memory_bytes: 43192
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}


fn main() {
    let n: usize = read().unwrap();
    let s: String = read().unwrap();
    let alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    let v_alph: Vec<char> = alph.chars().collect();

    let mut map: HashMap<char, usize> = HashMap::new();
    for (j, a_j) in alph.chars().enumerate() {
        map.insert(a_j, j);
    }
    // println!("{:?}", map);

    let mut after = String::new();
    for s_i in s.chars() {
        let s_num = map.get(&s_i).unwrap();
        let tmp = v_alph[(s_num + n) % 26];
        after.push(tmp);
    }
    println!("{}", after);
}


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

int main()
{
	string S;
	cin >> S;
	
	string next;
	if (S == "ABC")
	{
		next = "ARC";
	}
	else if (S == "ARC")
	{
		next = "ABC";
	}
	cout << next << endl;


	return 0;
}



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

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

  int nAs = 0;
  long long total = 0;

  for (int i = 0; i < S.size() - 1; i++) {

    if(S[i] == 'A') nAs += 1;
    else if(S[i] == 'B' && S[i + 1] == 'C') { total += nAs; i += 1; }
    else nAs = 0;
  }

  cout << total << endl;
}


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

using namespace std;

int main(){
  long long A, B, C, K;
  cin >> A >> B >> C >> K;
  
  if(A + B >= K) cout << min(A, K) << endl;
  else cout << A - (K - A - B) << endl;
  
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	constexpr long long int mod = 1000000007LL;
	int n, k; std::cin >> n >> k;
	std::vector<long long int> factorial(k + 1, 1LL), inverse_factorial(k + 1, 1LL);
	for (auto i = 2; i <= k; ++i) {
		factorial[i] = i * factorial[i - 1] % mod;
		inverse_factorial[i] = (mod - mod / i) * inverse_factorial[mod % i] % mod;
	}
	for (auto i = 2; i <= k; ++i) inverse_factorial[i] = inverse_factorial[i - 1] * inverse_factorial[i] % mod;
	std::vector<std::vector<int>> node(n);
	for (auto i = 1; i < n; ++i) {
		int a, b; std::cin >> a >> b;
		node[a - 1].push_back(b - 1);
		node[b - 1].push_back(a - 1);
	}
	std::vector<bool> search(n, false); search[0] = true;
	std::vector<int> parent(n, -1);
	std::queue<int> queue; queue.push(0);
	while (!queue.empty()) {
		auto front = queue.front(); queue.pop();
		node[front].erase(std::remove_if(node[front].begin(), node[front].end(), [&search](const int i) {return search[i]; }), node[front].end());
		for (const auto i : node[front]) {
			search[i] = true;
			parent[i] = front;
			queue.push(i);
		}
	}
	std::vector<long long int> pattern(n, 0LL);
	if (node[0].size() + 1 <= k) pattern[0] = factorial[k] * inverse_factorial[k - node[0].size() - 1] % mod;
	for (auto i = 1; i < n; ++i) {
		if (node[i].size() + 2 <= k) {
			pattern[i] = factorial[k - 2] * inverse_factorial[k - 2 - node[i].size()] % mod;
		}
	}
	std::vector<int> child_count; std::transform(node.begin(), node.end(), std::back_inserter(child_count), [](const std::vector<int>& c) {return c.size(); });
	for (auto i = 0; i < n; ++i) if (child_count[i] == 0) queue.push(i);
	while (!queue.empty() && queue.front() != 0) {
		auto front = queue.front(); queue.pop();
		pattern[parent[front]] *= pattern[front];
		pattern[parent[front]] %= mod;
		if (--child_count[parent[front]] == 0) queue.push(parent[front]);
	}
	std::cout << pattern[0] << std::endl;
}

Measured memory_bytes: 9976
#include"bits/stdc++.h"

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

int main() {
	int n;
	cin >> n;
	cout << pow(n,3) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(){
    int a;
    int t;
    char buf[30];

    fgets(buf, sizeof(buf), stdin);

    a = atoi(buf);
    t = a+a*a+a*a*a;
     
    printf("%d\n", t);
}

Measured memory_bytes: 1668
#include <stdio.h>

void sort(int *a,int n)
{
        int max,index,i,j;
        for(i=0;i<n;i++){
                max=a[i];index=i;
                for(j=i;j<n;j++){
                        if(max<a[j]){
                                max=a[j];  index=j;
                        }
                }
                a[index]=a[i]; a[i]=max;
        }
        return ;
}


int main(void)
{
        int n,i,c;

        scanf("%d",&n);

        int d[n];

        for(i=0;i<n;i++)
                scanf("%d",&d[i]);

        sort(d,n);
        c=1;
        for(i=1;i<n;i++){
                if(d[i]!=d[i-1]) c++;
        }

        printf("%d\n",c);
        return 0;
}


Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
o=[0]*61
z=[0]*61
mod=10**9+7
ans=0
for i in range(n):
  x=a[i]
  for j in range(61):
    if x&1:o[j]+=1
    else:z[j]+=1
    x>>=1
x=1
for i in range(61):
  ans=(ans+(x*o[i]*z[i])%mod)%mod
  x=(x*2%mod)
print(ans)

Measured memory_bytes: 122936
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    int N;
    cin>>N;
    double ans=0.0;
    rep(i,N){
        double x;
        string u;
        cin>>x>>u;
        if(u=="JPY"){
            ans+=x;
        }
        else{
            ans+=x*380000.0;
        }
    }
    cout<<fixed<<setprecision(10);
    cout<<ans<<endl;
}

Measured memory_bytes: 3768
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int n,h,m;
	scanf("%d",&n);
	for(;n--;){
		scanf("%d:%d",&h,&m);
		double s=h*30+m/2.,l=m*6,t,d;
		l<s?t=l,l=s,s=t:0;
		d=min(l-s,s-l+360);
		if(d<30){
			puts("alert");
		}else if(d<90){
			puts("warning");
		}else{
			puts("safe");
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define 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 VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll MOD = 1e9 + 7;
// return a^b O(log b)
template<typename T>
T mypow(T a, T b){
    if (b == 0)
        return 1;
    T tmp = mypow(a, b / 2);
    if (b % 2)
        return (((tmp * tmp) % MOD) * a) % MOD;
    else
        return (tmp * tmp) % MOD;
}
static bool init = false;
const ll mmm = 2e5 + 10;
vector<ll> frc(mmm + 1, 1), inv(mmm + 1, 1);
long long comb(ll n, ll k){
    if(!init){
		init = true;
		REP(i, mmm){
			frc[i + 1] = (frc[i] * (i + 1)) % MOD;
			inv[i + 1] = mypow(frc[i + 1], MOD - 2);
		}
	}
    ll res = 1;
    k = min(n - k, k);
    for (int i = 1; i <= k; i++) {
        res = (res * (n - i + 1)) % MOD;
        res = (res * inv[i]) % MOD;
    }
    return res;
}

// nCk O(n + klogMOD)
long long combT(int n, int k){
    long long res = 1;
    k = std::min(n - k, k);
    for (int i = n - k + 1; i <= n; i++)
        res = (res * i) % MOD;
    for (int i = 1; i <= k; i++)
        res = (res * mypow(static_cast<long long>(i), static_cast<long long>(MOD - 2))) % MOD;
    return res;
}

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

    ll n, a, b;
    cin >> n >> a >> b;
    ll res = (mypow(2LL, n) - 1 + (MOD - combT(n, a)) % MOD + (MOD - combT(n, b)) % MOD) % MOD;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
int main(void)
{
  char a[50],b[50];
  int i;
  scanf("%s",a);
  scanf("%s",b);
  for (i=0;a[i]!='\0';i++) {
    if (a[i]!='\0')printf("%c",a[i]);
    if (b[i]!='\0')printf("%c",b[i]);
  }
  putchar('\n');
  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,s,e) for(int i=(s);i<(e);i++)
#define REP(i,n) FOR(i,0,n)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int k;
    cin >> k;
    REP(i, s.size()){
        if(i == s.size()-1) s[i] = (s[i]-'a'+k)%26 + 'a';
        else if(('z'-s[i]+1)%26 > k) continue;
        else{
            k -= ('z'-s[i]+1)%26;
            s[i] = 'a';
        }
    }
    cout << s << endl;
    
    return 0;
}


Measured memory_bytes: 592
#include<iostream>
#include<algorithm>
using namespace std;
int x,y,size,maxm,cnt;
int t[10][10];
char ch;
void pl(int y,int x){
  if(y<0||y>=10||x<0||x>=10)return;
  t[y][x]++;
  maxm=max(maxm,t[y][x]);
}

int main(){
  for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
      t[i][j]=0;
  maxm=0;
  while(cin>>x>>ch>>y>>ch>>size){
    if(size==1){
      pl(y,x);
      pl(y+1,x);
      pl(y-1,x);
      pl(y,x+1);
      pl(y,x-1);
    }else if(size==2){
      for(int i=y-1;i<y+2;i++){
	for(int j=x-1;j<x+2;j++){
	  pl(i,j);
	}
      }
    }else{
      for(int i=y-1;i<y+2;i++){
	for(int j=x-1;j<x+2;j++){
	  pl(i,j);
	}
      }
      pl(y+2,x);pl(y-2,x);pl(y,x+2);pl(y,x-2);
    }
  }
  cnt=0;
  for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
      if(t[i][j]==0)cnt++;
  cout<<cnt<<endl;
  cout<<maxm<<endl;
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>    
#include<cstdio>  
#include<stdio.h>  
#include<cstring>    
#include<cstdio>    
#include<climits>    
#include<cmath>   
#include<vector>  
#include <bitset>  
#include<algorithm>    
#include <queue>  
#include<map>  
using namespace std; 


/*start:17/5/19 15:56*/
/*end:17/5/19   16:58  */

int a,b,c;
int main()
{
	cin>>a>>b>>c;
	if(c>=a&&c<=b)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll mininf = -922337203685477;
const ll nax = 1e5 + 5;
int n;

int main(){
	IOS
	cin >> n;
	int arr[n+5], sums=0;
	for(int i=0;i<n;i++){
		cin >> arr[i];
		sums^=arr[i];
	}
	for(int i=0;i<n;i++){
		int temp=sums;
		temp^=arr[i];
		cout << temp;
		if(i+1!=n){
			cout << ' ';
		}
	}
	cout << '\n';
}


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

int main() {
  ll a,b,c;cin>>a>>b>>c;
  if(a%2==0||b%2==0||c%2==0)cout<<0<<endl;
  else{
    ll ans=min({a*b,b*c,c*a});
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fi first
#define se second
#define maxn 1000003
#define mod 1000000007
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pi;

int n;
LL ans;
LL pw8[maxn];
LL pw9[maxn];
LL fact[maxn];

LL calc(LL x , int y) {
	if(!y)
		return 1;
	LL res = calc(x,y/2);
	res = res*res % mod;
	if(y&1)
		res = res*x % mod;
	return res;
}

int main() {
	scanf("%d",&n);
	fact[0] = 1;
	for( int i = 1 ; i <= n ; i++ )
		fact[i] = fact[i-1]*i % mod;
	pw8[0] = 1;
	for( int i = 1 ; i <= n ; i++ )
		pw8[i] = pw8[i-1]*8 % mod;
	pw9[0] = 1;
	for( int i = 1 ; i <= n ; i++ )
		pw9[i] = pw9[i-1]*9 % mod;
	for( int i = 1 ; i < n ; i++ ) {
		LL comb = fact[n];
		LL rev = fact[i]*fact[n-i] % mod;
		comb = comb * calc(rev,mod-2) % mod;
		LL sum = pw9[n-i] - pw8[n-i] + mod;
		sum %= mod;
		ans += comb*sum % mod;
		ans %= mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 27020
n, k = gets.chomp.split(" ").map(&:to_i)
arr = gets.chomp.split(" ").map(&:to_i).sort

if k == 2
  puts n-1
  exit
end

if n == k
  puts 1
  exit
end

if n * 2 == k
  puts 3
  exit
end

if n/k == 1
  puts 2
  exit
end

2.upto(n) do |i|
  if (k * i) - (i-1) >= n
    puts i
    exit
  end
end


Measured memory_bytes: 10248
let modulo = 1_000_000_007
let (+%) a b = (a + b) mod modulo
let (-%) a b = let tmp = (a - b) mod modulo in
               if tmp >= 0 then tmp
               else tmp + modulo
let ( *% ) a b = (a * b) mod modulo
let rec ( **% ) a n =
  if n = 0 then 1
  else if n mod 2 = 1 then a *% a **% (n - 1)
  else let t = a **% (n / 2) in t *% t
let (/%) a b =
  let inv a = a **% (modulo - 2)
  in
  a *% inv b

let m_nCr = Array.make_matrix 3000 3000 (-1)
let rec nCr n r =
  if n < 0  || r < 0 || n < r then 0
  else
    if m_nCr.(n).(r) >= 0 then m_nCr.(n).(r)
    else (m_nCr.(n).(r) <- if n = r then 1
                           else if r = 0 then 1
                           else nCr (n - 1) (r - 1) +% nCr (n - 1) r;
          m_nCr.(n).(r))
  
let () =
  let (n, k) = Scanf.sscanf (input_line stdin) "%d %d" (fun a b -> (a, b)) in
  let rec loop i =
    if i > k then ()
    else
      let ans = nCr (n-k+1) i *% nCr (k-1) (i-1) in
      (print_int ans;
       print_newline ();
       loop (i + 1))
  in loop 1
    


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

int main() {
  long long n;
  cin>>n;
  vector<long long>a(n);
  for(long long i=0;i<n;i++) cin>>a[i];
  long long ans=0;
  bool zero=false;
  long long minus=1000000000;
  long long num=0;
  for(int i=0;i<n;i++){
    ans+=abs(a[i]);
    minus=min(minus,abs(a[i]));
    if(a[i]<0) num++;
    if(a[i]==0) zero=true;
  }
  if(num%2==0 || zero) cout<<ans<<endl;
  else cout<<ans-2*minus<<endl;
}

Measured memory_bytes: 4032
import math
D,G = map(int,input().split())
p=[]
c=[]
for i in range(D):
    p_tmp,c_tmp = map(int,input().split())
    p.append(p_tmp)
    c.append(c_tmp)

ans = sum(p)
for i in range(2**D):
    score_tmp = 0
    ans_tmp = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += p[j]*(j+1)*100+c[j]
            ans_tmp += p[j]

    if ans_tmp >= ans:
        continue
    elif score_tmp >= G:
        ans = min(ans,ans_tmp)
        continue
    else:
        for j in range(D):
            if (i>>(D-1-j))%2 == 1:
                continue
            elif score_tmp + p[D-1-j]*(D-j)*100 < G:
                break
            else:
                ans_tmp += math.ceil((G - score_tmp)/((D-j)*100))
                ans = min(ans,ans_tmp)
                break

print(ans)

Measured memory_bytes: 3064
//#define NDEBUG

#pragma region cp_template

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <utility>
#include <vector>

namespace n91 {

using i32 = std::int32_t;
using i64 = std::int64_t;
using u32 = std::uint32_t;
using u64 = std::uint64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

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

public:
  rec_lambda(F &&f) : f(std::move(f)) {}
  template <class... Args> auto operator()(Args &&... args) const {
    return f(*this, std::forward<Args>(args)...);
  }
};
template <class F> auto make_rec(F &&f) { return rec_lambda<F>(std::move(f)); }
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}
constexpr char eoln = '\n';
template <class T> T ceildiv(const T &l, const T &r) {
  return l / r + (l % r != 0 ? 1 : 0);
}

} // namespace n91

#pragma endregion cp_template

namespace n91 {

void yesno(const bool f) { std::cout << (f ? "Yes" : "No") << "\n"; }

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const usize k = scan<usize>();
  for (const usize i : rep(0, k)) {
    std::cout << "ACL";
  }
  std::cout << eoln;
}

} // namespace n91

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


Measured memory_bytes: 3592
S = list(input())
acgt = ['A', 'C', 'G', 'T']
lengths = []
l = 0
for x in S:
  if x in acgt:
    l += 1
  else:
    lengths.append(l)
    l = 0

if len(lengths) == 0 or l > 0:
  lengths.append(l)

print(max(lengths))


Measured memory_bytes: 2940