akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int n,k,q;
int a[5000],b[5000];

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>tr;

signed main(){
	scanf("%d%d%d",&n,&k,&q);
	set<P>mp;
	rep(i,n)scanf("%d",&a[i]),b[i]=a[i],mp.insert({a[i],i});
	sort(b,b+n);
	int ans=b[q-1]-b[0];
	set<int>se;
	se.insert(-1);
	se.insert(n);
	while(!mp.empty()){
		int d=mp.begin()->first;
		while(!mp.empty()&&mp.begin()->first<=d){
			se.insert(mp.begin()->second);
			mp.erase(mp.begin());
		}
		int cnt=0;
		int Min=-1,Max=-1;
		tr.clear();
		rep(j,n){
			if(a[j]>d)tr.insert(j);
		}
		for(auto IT=mp.begin();IT!=mp.end();IT++){
			if(IT->first<=d)continue;
			if(cnt==q)break;
			auto it=se.lower_bound(IT->second);
			auto it2=it;it2--;
			//if(*it-*it2-1<k)continue;
			int a=tr.order_of_key(*it);
			int b=tr.order_of_key(*it2);
			if(a-b<k)continue;
			if(cnt==0){
				Min=Max=IT->first;
			}
			Min=min(Min,IT->first);
			Max=max(Max,IT->first);
			tr.erase(IT->second);
			cnt++;
		}
		if(cnt==q)ans=min(ans,Max-Min);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;
bool cmp(string a,string b)
{
	if(a.size()!=b.size())
         return false;
         int i,j,k;
	for(i=0;i<a.size();i++)
	{
		int t=a.size();
		for(j=i,k=0;t;j=(j+1)%a.size(),k++)
		{
			t--;
			if(a[j]!=b[k])
			{
				break;
			}
		}
		if(t==0)
		return true;
		}	
	return false;
	
}
int main()
{
	string a,b;
	while(cin>>a>>b)
	{
		if(cmp(a,b))
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
		
	}
	
	
	return 0;
}

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

int main(){

    string s;

    while(cin >> s){

        char a[3][3];
        a[0][0] = s[0];
        a[0][1] = s[1];
        a[0][2] = s[2];
        a[1][0] = s[3];
        a[1][1] = s[4];
        a[1][2] = s[5];
        a[2][0] = s[6];
        a[2][1] = s[7];
        a[2][2] = s[8];
        char S = 's';
        bool ok = false;
        for(int i = 0; i < 3; i++){
            if(a[i][0] != S && a[i][0] == a[i][1] && a[i][1] == a[i][2]){
                cout << a[i][0] << endl;
                ok = true;
                break;
            }
        }

        for(int j = 0; j < 3; j++){
            if(ok) break;

            if(a[0][j] != S && a[0][j] == a[1][j] && a[1][j] == a[2][j]){
                cout << a[0][j] << endl;
                ok = true;
                break;
            }
        }
        
        if(!ok){
            if(a[0][0] != S && a[0][0] == a[1][1] && a[1][1] == a[2][2]){
                cout << a[0][0] << endl;
                ok = true;
            }else if(a[0][2] != S && a[0][2] == a[1][1] && a[1][1] == a[2][0]){
                cout << a[1][1] << endl;
                ok = true;
            }
        }

        if(!ok) cout << "d" << endl;
    }

    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#include <stdlib.h>
#include <cmath>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int main(){
    int N;
    cin>>N;
    vector<ll> d(N);
    ll ans=0;
    for(int i=0;i<N;i++) cin>>d.at(i);
    int memory=0;
    ll SUM=0;
    for(int i=0;i<N;i++){
        if(memory<N){
            while((SUM^d.at(memory))==SUM+d.at(memory)){
                SUM+=d.at(memory);
                memory++;
                if(memory==N) break;
            }
        }
        ans+=(memory-i);
        SUM-=d.at(i);
    }
    cout<<ans<<endl;

}

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

constexpr int INF = 2e9;

template <typename T> 
struct SegmentTree {
  
  int n;
  vector<T> node;

  T f(T a, T b) {return max(a, b);}

  SegmentTree (int sz, T init = 0) {
    n = 1; while (n < sz) n <<= 1;
    node.assign(2*n, init);
    for (int i = n - 2; i >= 0; i--) node[i] = f(node[2*i+1], node[2*i+2]);
  }

  void update(int k, T x) {
    k += (n - 1);
    node[k] += x;
    while (k > 0) {
      k = (k - 1) >> 1;
      node[k] = f(node[2*k+1], node[2*k+2]);
    } 
  }

  T query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (r <= a || b <= l) return 0;
    if (a <= l && r <= b) return node[k];
    T vl = query(a, b, 2*k+1, l, (l+r)/2);
    T vr = query(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }

  T getvalue(int k) {
    return query(k,k+1);
  }

};

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  vector<int> a(n);
  rep(i,n) cin >> h[i];
  rep(i,n) cin >> a[i];

  SegmentTree<ll> dp(n+1,0);

  for (int i = 0; i < n; i++) {
    ll now = dp.query(0, h[i]) + a[i];
    dp.update(h[i], now);
  }
  cout << dp.query(0, n + 1) << endl;
  return 0;
} 

Measured memory_bytes: 5888
#include <iostream>
#include <math.h>

using namespace std;

int main() {
  int N = 1000001;
  int primes[N];
  int i, j;
  for (i = 2; i < N; i++) {
    primes[i] = 1;
  }

  for (i = 2; i <= int(sqrt(N)); i++) {
    if (primes[i]) {
      for (j = i*i; j < N; j+=i) {
        primes[j] = 0;
      }
    }
  }

  int n;
  while (cin >> n) {
    int ans = 0;
    for (i = 2; i <= n; i++) {
      ans += primes[i];
    }
    cout << ans << endl;
  }

  return 0;
}

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

int main()
{
    std::string S,T;
    std::cin >> S;
    std::cin >> T;
    int size=0;
    int changeNum=0;

    size=S.length();

    for(int i=0; i<size ; i++)
    {
        if(S[i] != T[i])
        {
            T[i]=S[i];
            changeNum++;
        }
    }
    std::cout << changeNum << std::endl;

    return 0;
}

Measured memory_bytes: 3880
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>

using namespace std;

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


Measured memory_bytes: 3568
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int N;
    cin >> N;
    VEC(Pii) A(N), B(N);
    READVEC(A);
    sort(ALL(A));
    READVEC(B);
    sort(ALL(B));

    VEC(bool) used(N, false);
    int ret = 0;
    for (Pii b : B) {
        Pii take(-1, -1);
        FOR(i, 0, N)
            if (!used[i] && A[i].FIR < b.FIR && A[i].SEC < b.SEC) {
                take = max(take, Pii(A[i].SEC, A[i].FIR));
            }

        if (take.FIR < 0)
            continue;

        FOR(i, 0, N)
            if (!used[i] && Pii(A[i].SEC, A[i].FIR) == take) {
                used[i] = true;
                ret++;
                break;
            }
    }

    cout << ret << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 256
S = input().rstrip()
T = input().rstrip()

ans = 1000
for offset in range(len(S) - len(T) + 1):
    miss = 0
    for s, t in zip(S[offset:offset+len(T)], T):
        if s != t:
            miss += 1
    ans = min(ans, miss)

print(ans)

Measured memory_bytes: 73476
n=int(input())
c=list(map(int, input().split()))
c = [0] + c + [0]
ans = 0

for i in range(n+1):
    ans += abs(c[i+1]-c[i])

for i in range(n):
    d = abs(c[i+1]-c[i])+ abs(c[i+2]-c[i+1])
    e = abs(c[i+2]-c[i])
    print(ans - d + e)

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


int main(){

 string s;
 cin>>s;

 string a="",res="";

 int cnt=0,n=0;

 for(int i=0;i<s.length();i++){

    if(s[i] == 'A' || s[i] == 'G' || s[i] == 'T' || s[i] == 'C'){
      res += s[i];

      if(n < res.size()){
        a = res;
        n = res.size();
      }
    }else
     res = "";

 }

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

 return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(set(map(lambda x : int(x)//2, input().split())))
def gcd(x, y):
  return x if y == 0 else gcd(y, x % y)
def lcm(x, y):
  return (x * y) // gcd(x, y)
l = A[0]
for a in A[1:]:
  l = lcm(l, a)
ans = (M // l + 1) // 2
for a in A[1:]:
  if (l // a) % 2 == 0:
    ans = 0
    break
print(ans)


Measured memory_bytes: 11356
#include <bits/stdc++.h>
using namespace std;
using u32 = uint32_t;

int main() {
	string N;
	cin >> N;
	
	u32 len = N.size();
	
	vector<vector<u32>> dp(2, vector<u32>(2));
	dp[0][0] = stoi(N.substr(0, 1));
	dp[0][1] = 10 - stoi(N.substr(0, 1));
	
	for(u32 i=1; i<len; i++) {
		u32 sp = stoi(N.substr(i, 1));
		bool ic = i & 1;
		bool ip = !ic;
		
		// seisan
		dp[ic][0] = sp + min(dp[ip][0], dp[ip][1] + 1);

		// kurikosi
		dp[ic][1] = min(10 - sp + dp[ip][0], dp[ip][1] + 9 - sp);
	}
	
	u32 ans = min(dp[(len-1)&1][0], dp[(len-1)&1][1] + 1);
	cout << ans;
	
	return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    long double a, b, c;
    cin >> a >> b >> c;

    long double eps = 1.0E-14;

    if((sqrt(a) + sqrt(b)) + eps < sqrt(c)){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }

}

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

#define rep(i,n)  for(int i=0;i<n;++i)
#define per(i,n)  for(int i=n-1;i>=0;--i)
#define sc1(a)  scanf("%d",&a)
#define sc2(a,b)  scanf("%d %d",&a,&b)
#define sc3(a,b,c)  scanf("%d %d %d",&a,&b,&c)
#define sl1(a)  scanf("%lld",&a)
#define sl2(a,b)  scanf("%lld %lld",&a,&b)
#define sl3(a,b,c)  scanf("%lld %lld %lld",&a,&b,&c)
#define PI 3.1415926535897932

int main(){
    int mod=1000000007;
    int n,m,ans;
    //scanf("%d %d",&n,&m);
    sc1(n);
    int room[4][3][10];
    rep(i,4) rep(j,3) rep(k,10) room[i][j][k]=0;
    rep (i,n) {
        int b,f,r,v;
        scanf("%d %d %d %d",&b,&f,&r,&v);
        room[b-1][f-1][r-1]+=v;
    }
    rep(i,4) {
        rep(j,3) {
            rep(k,10) {
                printf(" %d",room[i][j][k]);
            }
            puts("");
        }
        if (i<3) printf("####################\n");
    }
    return 0;
}



Measured memory_bytes: 3224
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
s = ns()

mod = 10**9+7

from collections import defaultdict

ans = 1
d = defaultdict(int)

for i in range(n):
	d[s[i]] += 1

for v in d.values():
	ans *= (v+1)
	ans = ans%mod

print(ans-1)

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)turn idx;
#define deg_to_rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad_to_deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)

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;
};

int main() {
  int D;
  cin >> D;
  if (D == 25) {
    cout << "Christmas" << endl;
    return 0;
  } else if (D == 24) {
    cout << "Christmas Eve" << endl;
    return 0;
  } else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
    return 0;
  } else if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
    return 0;
  }
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define M 300001
 
int main(){
    int N,Q,q,in,c[M]={0};
    cin >> N >> Q;
    for(int i = 0 ; i < N ; i++){
	scanf("%d",&in);
	c[in] = in;
    }
    for(int i = 1 ; i < M ; i++){
	c[i] = max(c[i],c[i-1]);
    }
    while(Q--){
	cin >> q;
	int r = 0;
	for(int i = q-1 ; i < M ; i += q){
	    r = max(r,c[i]%q);
	}
	printf("%d\n",r);
    }
    return 0;
}

Measured memory_bytes: 4380
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1e18+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

vector<int> TopologicalSort(const graph &g){
    int V = g.size();
    vector<int> indeg(V,0);
    for(auto &in_edge: g){
        for(auto &e: in_edge){
            indeg[e]++;
        }
    }
    queue<int> que;
    for(int i = 0; i<V; i++){
        if(indeg[i]==0) que.push(i);
    }
    vector<int> t_sort;
    while(!que.empty()){
        int v = que.front(); que.pop();
        for(auto &nv: g[v]){
            indeg[nv]--;
            if(indeg[nv]==0) que.push(nv);
        }
        t_sort.emplace_back(v);
    }
    return t_sort;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int v,e; cin >> v >> e;
    graph g(v);
    rep(i,0,e){
        int s,t;
        cin >> s >> t;
        g[s].emplace_back(t);
    }
    auto t_sort = TopologicalSort(g);
    rep(i,0,v){
        cout << t_sort[i] << endl;
    }
}


Measured memory_bytes: 3756
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		System.out.println(a * b % 2 == 0 ? "No" : "Yes");
	}
}

Measured memory_bytes: 23124
/*
*
* author: ian macleod
*
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef vector<long long int> vll;

#define IO                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b) for(ll i=a;i>=b;i--)

ll power(ll x, ll y) {
    ll res = 1;     // Initialize result
    x = x ;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0) {
        if (y & 1)
            res = (res*x);
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}


void solve() {
    
    ll x, y;
    cin >> x >> y;
    if (y % 2 != 0) {
        cout << "No" << endl;
        return;
    }
    ll r, l;
    l = 2*x;
    r = 4*x;
    if ( y>r || y<l) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
    return ;
}



int main() {
    solve();
}



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

char str[100006], mp[100];
int main(){
	scanf("%s", str);
	int size = strlen(str);
	for(int i = 0;i < size;i++){
		int a = str[i]-'a';
		mp[a] = 1;
		//printf("%d ", a);
	}
	
	for(int i = 0;;i++){
		if(mp[i] == 0){
			printf("%c\n", i+'a');
			break;
		}
		if(i+'a' == 'z'){
			printf("None\n");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>

char s[5001], t[6], c[5];
int k, n, l[6], i, j;
inline void findstr(const int x) {
  for (i = l[x]; i < n - x;) {
    for (j = 0; j <= x; ++j) {
      if (s[i + j] != t[j]) goto cont;
    }
    l[x + 1] = i;
    return;
  cont:
    ++i;
  }
  l[x + 1] = -1;
}
int main() {
  scanf("%s", s);
  scanf("%d", &k);
  n = strlen(s);
  for (c[0] = 'a'; c[0] <= 'z'; ++c[0]) {
    t[0] = c[0];
    findstr(0);
    if (l[1] < 0) continue;
    if (k == 1) {
      printf("%s\n", t);
      return 0;
    }
    --k;
    for (c[1] = 'a'; c[1] <= 'z'; ++c[1]) {
      t[1] = c[1];
      findstr(1);
      if (l[2] < 0) continue;
      if (k == 1) {
        printf("%s\n", t);
        return 0;
      }
      --k;
      for (c[2] = 'a'; c[2] <= 'z'; ++c[2]) {
        t[2] = c[2];
        findstr(2);
        if (l[3] < 0) continue;
        if (k == 1) {
          printf("%s\n", t);
          return 0;
        }
        --k;
        for (c[3] = 'a'; c[3] <= 'z'; ++c[3]) {
          t[3] = c[3];
          findstr(3);
          if (l[4] < 0) continue;
          if (k == 1) {
            printf("%s\n", t);
            return 0;
          }
          --k;
          for (c[4] = 'a'; c[4] <= 'z'; ++c[4]) {
            t[4] = c[4];
            findstr(4);
            if (l[5] < 0) continue;
            if (k == 1) {
              printf("%s\n", t);
              return 0;
            }
            --k;
          }
          t[4] = 0;
        }
        t[3] = 0;
      }
      t[2] = 0;
    }
    t[1] = 0;
  }
}


Measured memory_bytes: 1652
class Solver(object):
    def __init__(self):
        self.h, self.w = list(map(int, input().split(" ")))
        self.grid = [[] for _ in range(self.h)]  # grid[row][column]
        for row in range(self.h):
            for value in input():
                self.grid[row].append(value)

    def solve(self):
        for row in range(self.h):
            for column in range(self.w):
                if self.grid[row][column] == ".":
                    self.check_and_delete(row, column)
        self.print_grid()

    def check_and_delete(self, row, column):
        # row-wise
        delete = True
        for c in range(self.w):
            if self.grid[row][c] is not None:
                if self.grid[row][c] == "#":
                    delete = False
        if delete:
            for c in range(self.w):
                self.grid[row][c] = None

        # column-wise
        delete = True
        for r in range(self.h):
            if self.grid[r][column] is not None:
                if self.grid[r][column] == "#":
                    delete = False
        if delete:
            for r in range(self.h):
                self.grid[r][column] = None
    
    def print_grid(self):
        for row in self.grid:
            printed = False
            for column in row:
                if column is not None:
                    printed = True
                    print(column, end="")
            if printed:
                print()


if __name__ == "__main__":
    s = Solver()
    s.solve()

Measured memory_bytes: 4724
def gcd(a,b):
    if b == 0: return a
    if a < b: a, b = b, a
    if a % b == 0: return b
    while b:
        a, b = b, a % b
    return a

def lcd(a,b):
    return a * b // gcd(a,b)

n = int(input())
t = [int(input()) for i in range(n)]
ans = 1
for i in t:
    ans = lcd(ans, i)
print(int(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=105;

int n, ans=0;
int a[N];

int32_t main()
{
	IOS;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
	{
		while(a[i]>0)
		{
			int j;
			for(j=i;j<=n;j++)
			{
				if(a[j]==0)
					break;
			}
			for(int k=i;k<j;k++)
				a[k]--;
			ans++;
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n,l;
char str[105][105];
int main(){
    scanf("%d%d",&n,&l);
    int i,j;
    for(i = 0; i < n; i++){
        scanf("%s",str[i]);
    }
    char tmp[105];
    for(i = 0; i < n-1; i++){
        for(j = i+1; j < n; j++){
            if(strcmp(str[i],str[j])>0){
                strcpy(tmp,str[i]);
                strcpy(str[i],str[j]);
                strcpy(str[j],tmp);
            }
        }
    }
    for(i = 0; i < n; i++){
        if(i!=n-1)
            printf("%s",str[i]);
        else
            printf("%s\n",str[i]);
    }
    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 REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(998244353)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)


llong beki(llong a,llong x){
    llong res = 1;
    llong tmp = a;
    while(x > 0){
        if(x & 1) res *= tmp; res %= MOD;
        tmp *= tmp;
        tmp %= MOD;
        x >>=1;
    }
    return res;
}

signed main(){
    int n;
    cin >> n;
    int A[n];
    int su = 0;
    REP(i,n){
        cin >> A[i];
        su += A[i];
    }

    int dp[su + 2] = {};
    dp[0] = 1;
    REP(i,n){
        dp[0] *= 2;
        dp[0]%= MOD;
    }
    int gyaku = beki(2,MOD- 2);


     REP(i,n){
         REPR(j,su){
             if(j + A[i] > su) continue;
             int tmp = dp[j] * gyaku % MOD;
             dp[j + A[i]] += tmp;
             dp[j + A[i]] %= MOD;
         }
     }

     
     int res = 1;
     REP(i,n){
         res *= 3;
         res %= MOD;
     }
     res += 3;
     res %= MOD;
     res = res + 3 * MOD - 3 * dp[0];
     res %= MOD;
    FOR(i,(su  + 1)/ 2  , su){
        res += 3 * MOD;
        res -= 3 * dp[i];
        res %= MOD;
    }

    int kosu[su + 2] = {} ;
    kosu[0] = 1;
    REP(i,n){
        REPR(j,su ){
            if(j + A[i] >= su) continue;
            kosu[j + A[i]] += kosu[j];
            kosu[j + A[i] ] %= MOD;
        }
    }


    int tmp = 0;
    

    FOR(i,(su + 1) / 2  , su){
        tmp += kosu[i];
        tmp %= MOD;
    }
    res += 6 * tmp;
    res %= MOD;
    cout << res << endl;  
    


}


Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
#else
	#define DBG(X)
#endif

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;
using std::swap;
using std::sort;
using std::lower_bound;
using std::unique;

using int64 = long long int;
using pii   = pair<int, int>;
using pii64 = pair<int64, int64>;

const int NIL = -1;
const int INF = (int)2e9;
const int64 INF64 = (int64)2e18;

void init_IO() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}

const int MOD = (int)1e9 + 7;

int add(int x, int y) {
	return (x + y >= MOD ? x + y - MOD : x + y);
}

int mult(int x, int y) {
	return (x * 1LL * y) % MOD;
}

void solve() {
	string s;
	cin >> s;

	int dpA = 0, dpAB = 0, dpABC = 0;
	int ways = 1;

	for(auto& ch: s) {
		int n_dpA   = 0;
		int n_dpAB  = 0;
		int n_dpABC = 0;

		for(auto& to_add: {'A', 'B', 'C'}) {
			if(ch == '?' || to_add == ch) {
				if(to_add == 'A') {
					n_dpA = add(n_dpA, add(dpA, ways));
				} else {
					n_dpA = add(n_dpA, dpA);
				}

				if(to_add == 'B') {
					n_dpAB = add(n_dpAB, add(dpAB, dpA));
				} else {
					n_dpAB = add(n_dpAB, dpAB);
				}

				if(to_add == 'C') {
					n_dpABC = add(n_dpABC, add(dpABC, dpAB));
				} else {
					n_dpABC = add(n_dpABC, dpABC);
				}
			}
		}

		dpA   = n_dpA;
		dpAB  = n_dpAB;
		dpABC = n_dpABC;

		if(ch == '?') {
			ways = mult(ways, 3);
		}

		//cout << dpA << ' ' << dpAB << ' ' << dpABC << '\n';
	}

	cout << dpABC << '\n';
}

int main() {
	init_IO();
	solve();

	return 0;
}


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

using namespace std;

typedef long long int ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll l, r;
    
    cin >> l >> r;
    
    ll ans = 2019;
    
    if(r - l >= 2019){
    	ans = 0;
	}
	else{   
	    for(ll i = l; i <= r; i++){
	    	for(ll j = i + 1; j <= r; j++){
	    		ans = min(ans, (i * j) % 2019);
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}




Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
// using ll = long long;
// using vi = vector<int>;
// using vvi = vector<vi>;
// using vl = vector<long long>;
// using vvl = vector<vl>;
// using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int kaijo (int a, int result) {
  if (a == 0) {
    return result;
  } else {
    return kaijo(a-1, result * a);
  }
}

int kaijo(int a) {
  return kaijo(a,1);
}

ll kaijo_ll (ll a, ll result) {
  if (a == 0) {
    return result;
  } else {
    return kaijo_ll(a-1, result * a);
  }
}

ll kaijo_ll(ll a) {
  return kaijo_ll(a,1);
}

int main () {
  int n;
  double result = 0;
  cin >> n;
  std::vector<int> v(n);
  rep(i,n) cin >> v[i];
  VSORT(v);
  result += v[0];
  rep(i, n-1) {
    result += v[i+1];
    result /= 2;
  }
  printf("%.20lf\n", result);
}


Measured memory_bytes: 256
import bisect

n = int(input())
l = list(map(int, input().split()))
l.sort()

total = 0
for a in range(n-2):
    for b in range(a+1, n-1):
        c = bisect.bisect_left(l, l[a] + l[b]) - b - 1
        total += c

print(total)

Measured memory_bytes: 3316
/******
	~site:    atcoder.jp
	~user:    Turkhuu
	~problem: AtCoder Beginner Contest 177 - C (abc177_c)
** **/

#include<bits/stdc++.h>

#define FFOR(i,s,e,k) for(int i=s;(k==1?i<=e:i>=e);i+=k)
#define FOR(i,n) FFOR(i,0,n-1,1)
#define FORR(i,s,e) FFOR(i,s,e,1)
#define ll long long
#define PQ priority_queue
#define pb push_back
#define ppb pop_back()
#define pp push
#define MIN(v) *min_element(v.begin(),v.end())
#define MAX(v) *max_element(v.begin(),v.end())
#define SORT(v) sort(v.begin(),v.end())
#define TROS(v) sort(v.rbegin(),v.rend())
#define CNT(v,x) count(v.begin(),v.end(),x)
#define MOD 1000000007
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	ll a[200001];
	FOR(i,n){
		cin>>a[i];
		if(i>0) a[i]+=a[i-1];
	}
	ll sum=0;
	FOR(i,n){
		int k=(i==0?a[i]:a[i]-a[i-1]);
		sum+=((k%MOD)*((a[n-1]-a[i])%MOD))%MOD;
		sum%=MOD;
	}
	cout<<sum%MOD;
}


Measured memory_bytes: 5164
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
const int N = 1e5;
ll dp[N];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,n,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    	cin>>n>>k;
    	ll ar[n];
    	for(int i = 0; i < n; i++)
    	{
    		cin>>ar[i];
    	}
    	for(int i=0;i<n;i++)
    	{
    		dp[i] = INT_MAX;
    	}
    	dp[0] = 0;
    	for(int i=1;i<k;i++)
    	{
    		for(int j = 1; j <= i; j++)
    		{
    			dp[i] = min(dp[i-j]+abs(ar[i]-ar[i-j]), dp[i]);
    		}
    	}
    	for(int i=k; i < n; i++)
    	{
    		for(int j = 1; j <= k; j++)
    		{
    			dp[i] = min(dp[i],dp[i-j]+abs(ar[i]-ar[i-j]));
    		}
    	}
    	cout<<dp[n-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int xy[200000];
int tmp[200000];

void sort(int lb, int ub) {
	int i, j, k;
	if (ub - lb <= 1) return;
	int m = (lb + ub) >> 1;
	sort(lb, m);
	sort(m, ub);
	for (i = lb; i < ub; i++) {
		tmp[i << 1] = xy[i << 1];
		tmp[(i << 1) | 1] = xy[(i << 1) | 1];
	}
	for (i = lb, j = lb, k = m; i < ub; i++) {
		if (j == m) {
			xy[i << 1] = tmp[k << 1];
			xy[(i << 1) | 1] = tmp[(k << 1) | 1];
			++k;
		}
		else if (k == ub) {
			xy[i << 1] = tmp[j << 1];
			xy[(i << 1) | 1] = tmp[(j << 1) | 1];
			++j;
		}
		else if (tmp[j << 1] < tmp[k << 1] || (tmp[j << 1] == tmp[k << 1] && tmp[(j << 1) | 1] < tmp[(k << 1) | 1])) {
			xy[i << 1] = tmp[j << 1];
			xy[(i << 1) | 1] = tmp[(j << 1) | 1];
			++j;
		}
		else {
			xy[i << 1] = tmp[k << 1];
			xy[(i << 1) | 1] = tmp[(k << 1) | 1];
			++k;
		}
	}
}

int main(void)
{
	int n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &xy[i << 1], &xy[(i << 1) | 1]);
	}
	sort(0, n);
	for (i = 0; i < n; i++) {
		printf("%d %d\n", xy[i << 1], xy[(i << 1) | 1]);
	}
	return 0;
}



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

using namespace std;


int main()
{
    int n,x;
    cin>>n>>x;
    int ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        
    }
    sort(ar,ar+n);
    int count=0;
    long sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=ar[i];
        if(i!=n-1&&sum<=x)
            count++;
        else if(i==n-1&&sum==x)
            count++;
    }
    cout<<count;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n;
    cin >> n;
    vector<li> as(n);
    li sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> as[i];
        sum ^= as[i];
    }
    for (int i = 0; i < n; ++i) {
        cout << (sum ^ as[i]);
        if (i + 1 == n) {
            cout << endl;
        } else {
            cout << " ";
        }
    }

    return 0;
}

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

using namespace std;

int main(){
	int con = 0;
	string a , ain;
	cin >> a;
	int io = a.size() - 1 ;
	for(int i = 0 ; i < a.size() / 2 ; i++){
		if(a[i] != a[ io ]){
			//cout << i << " " << i + io << endl;
			con++;
			//cout << a[i] << " " << a[i + io ] << endl;
		}
		io--;
		
	}
	cout << con << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    string x,y;
	cin >> x>> y;
    int ans=0;
    fr(i,3){
      if(x[i]==y[i])ans++;
    }
      cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int l,r,d,ans=0;
	cin>>l>>r>>d;
	for(int i=l;i<=r;i++){
		if(i%d==0){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3592
N, x, y = map(int, input().split())

out = [0] * (N)

for i in range(1,N):
    for j in range(i+1,N+1):
        # i,jの距離を求める ３パーターンのうち一番短いパターン
        # i→jパターン abs(j-i)
        # i→x→y→jパターン abs(i-x)+1+abs(j-y)
        # i→y→x→jパターン abs(i-y)+1+abs(j-x)
        dist = min(abs(j-i), abs(i-x)+1+abs(j-y), abs(i-y)+1+abs(j-x))
        out[dist] += 1

for i in range(1,N):
    print(out[i])


Measured memory_bytes: 47836
/*
				GAURAV KUMAR
				 MNNIT
				  BTECH 3RD YEAR
*/

#include<bits/stdc++.h>
using namespace std;
#define debug1(x) cout << # x << " " << x << endl;
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define debug3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z << endl;
#define debug4(x,y,z,w) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z <<  " " << #w << " "<<w <<endl;

typedef long long int ll;
const ll INF=1e12;
ll dp[21][1<<22+1];
int n;
ll a[401][401];
ll pre[401];
#define mod 1000000007
ll solve(int i,int mask)
{
//	debug3(i,mask,1<<3-1);
	//debug1(n);
	ll t1=1<<n;
	t1--;
//	debug1(t1);
	if(i>n-1 && mask==t1)
		return 1;
	if(i>n-1)
		return 0;
	ll ans=0;
	if(dp[i][mask]!=-1)return dp[i][mask];
	for(int j=0;j<n;j++)
	{

		
		if(((mask>>j)&1)==0 && a[i][j]==1)
		{
		
//			debug3(i,j,mask);
			ans=(ans%mod+solve(i+1,mask|(1<<j))%mod)%mod;
		}
	}
	return dp[i][mask]=ans;

}
int main()
{
	

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t;
	
		
		
		cin>>n;
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
			cin>>a[i][j];
		for(int i=0;i<n;i++)
			for(int j=0;j<(1<<21+1);j++)
				dp[i][j]=-1;
		cout<<solve(0,0)<<endl;
	
	
}

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

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

	vector<int> vec(n);
	for (auto& e : vec) {
		cin >> e;
	}

	sort(vec.begin(), vec.end());
	int ans = 0;

	for (int a = 0; a < n - 2; a++) {
		for (int b = a + 1; b < n - 1; b++) {
			ans += (lower_bound(vec.begin(), vec.end(), vec[a] + vec[b]) - vec.begin()) - (b + 1);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    a = root(a);
    return -Parent[a];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(a < b) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }

  bool issame(int a, int b){
    return root(a) == root(b);
  }
};

int main(){
  int n,a,b; cin >> n >> a >> b;
  cout << ((a-b)%2 ? "Borys" : "Alice") << endl;
}

Measured memory_bytes: 256
import math
N,M = map(int,input().split())
if abs(N - M) > 1:
  print(0)
elif N == M:
  print((2*(math.factorial(N) * math.factorial(M))) % 1000000007)
else:
  print(((math.factorial(N) * math.factorial(M))) % 1000000007)

Measured memory_bytes: 5192
#include <iostream>
#include <string>
using namespace std;
int main()
{
 string S,T;
  int count=0;
 cin>>S>>T;
  int n=S.length();
  
  for(int i=0;i<n;i++)
  {
    if(S.at(i)!=T.at(i))
    {
      count++;
    }
    
  }
  
  cout<<count<<endl;
  
  return 0;
  
}

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

namespace _1_2_D {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine();
            var array = input.Split(' ').Select(s => int.Parse(s)).ToArray();
            int W = array[0];
            int H = array[1];
            int x = array[2];
            int y = array[3];
            var r = array[4];

            if (x - r < 0 || x + r > W ||
                y - r < 0 || y + r > H) {
                Console.WriteLine("No");
            }
            else {
                Console.WriteLine("Yes");
            }
        }
    }
}



Measured memory_bytes: 20464
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits.h>
#include <cmath>
#include <map>
#include <utility>
using namespace std;
using P = pair<int,int>;
using ll = long long;
const int MOD=1e9+7;
constexpr int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];
bool COMinited = false;
long long COM(int n, int k) {
  if (COMinited == false) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i - 1] * i % MOD;
      inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
      finv[i] = finv[i - 1] * inv[i] % MOD;
    }
    COMinited = true;
  }
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long mypow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long modinv(long long a, long long mod=MOD) { return modpow(a, mod - 2, mod); }
long long PER(long long n,long long r){
    if(n<r)return 0;
    return fac[n]*modinv(fac[n-r])%MOD;
}
int main(){
    int n,m;
    cin>>n>>m;
    int ret=0;
    for(int i=0;i<=n;i++){
        ret+=COM(n,i)*mypow(-1,i)%MOD*PER(m,i)%MOD*PER(m-i,n-i)%MOD*PER(m-i,n-i)%MOD;
        ret%=MOD;
        ret+=MOD;
        ret%=MOD;
    }
    cout<<ret<<endl;
}


Measured memory_bytes: 15596
import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();

    long ans = 0;

    for(int i=1;i<=n;i++){
      if(i%3!=0 && i%5!=0){
        ans += i;
      }
    }

    System.out.println(ans);

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<long long> A(n);
    vector<long long> B(m), C(m);
    vector<pair<long long, long long>> v;
    for (int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    for (int i = 0; i < m; i++)
    {
        cin >> B[i] >> C[i];
        v.emplace_back(make_pair(C[i], B[i]));
    }
    sort(A.begin(), A.end());
    sort(v.rbegin(), v.rend());
    long long ans = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m + 1; j++)
        {
            if (A[i] >= v[j].first || j == m)
            {
                for (int k = 0; k < n; k++)
                {
                    ans += A[k];
                }
                cout << ans << endl;
                return 0;
            }
            while (A[i] < v[j].first && v[j].second)
            {
                A[i] = v[j].first;
                v[j].second--;
                i++;
            }
        }
    }
}


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

constexpr int intMax = (1 << 30) - 1 + (1 << 30);
constexpr int intHalf = intMax / 2; // > 10^9

int main()
{
	int n;
	cin >> n;
	vector<array<int, 3>> abcls(n);
	for (auto& abc : abcls)cin >> abc[0] >> abc[1] >> abc[2];
	vector<array<int, 3>> dp_max(n);
	int minNum;
	for (int i = 0; i < 3; ++i)dp_max[0][i] = abcls[0][i];
	for (int i = 1; i < n; ++i) {
		dp_max[i][0] = max(dp_max[i - 1][1], dp_max[i - 1][2]) + abcls[i][0];
		dp_max[i][1] = max(dp_max[i - 1][0], dp_max[i - 1][2]) + abcls[i][1];
		dp_max[i][2] = max(dp_max[i - 1][0], dp_max[i - 1][1]) + abcls[i][2];
	}

	cout << max(dp_max[n - 1][0], max(dp_max[n - 1][1], dp_max[n - 1][2])) << endl;
	return 0;
}

Measured memory_bytes: 2560
def main():
    H, W, M = (int(i) for i in input().split())
    hc = [0]*(H+1)
    wc = [0]*(W+1)
    maps = set()
    for _ in range(M):
        h, w = (int(i) for i in input().split())
        hc[h] += 1
        wc[w] += 1
        maps.add((h, w))
    mah = -1
    maw = -1
    hmaps = set()
    wmaps = set()
    for i, h in enumerate(hc):
        if mah < h:
            mah = h
            hmaps = {i}
        elif mah == h:
            hmaps.add(i)
    for i, w in enumerate(wc):
        if maw < w:
            maw = w
            wmaps = {i}
        elif maw == w:
            wmaps.add(i)
    ans = mah+maw
    aru = True

    for h in hmaps:
        for w in wmaps:
            if (h, w) not in maps:
                aru = False
                break
        if not aru:
            break
    if aru:
        print(ans - 1)
    else:
        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 216176
#include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define io  ios_base::sync_with_stdio(false); cin.tie(NULL); 
    int main() 
    { 
        io
        ll n, r,s=0;
      
        cin>>n>>r;
       if(n<10)
       {
           s=r+(100*(10-n));
       }
          else
          {
              s=r;
          }
        
     
           cout<<s<<endl;
    }

Measured memory_bytes: 256