akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
int main(){
  int i,j;
  char s[1001];
  int len;
  gets(s);
  len=strlen(s);
  for(i=0;i<len-4;i++){
    if(s[i]=='a' && s[i+1]=='p' && s[i+2]=='p' && s[i+3]=='l' && s[i+4]=='e'){
      s[i]='p';
      s[i+1]='e';
      s[i+2]='a';
      s[i+3]='c';
      s[i+4]='h';
    }
    
    else if(s[i]=='p' && s[i+1]=='e' && s[i+2]=='a' && s[i+3]=='c' && s[i+4]=='h'){
      s[i]='a';
      s[i+1]='p';
      s[i+2]='p';
      s[i+3]='l';
      s[i+4]='e';
    }
  }
  printf("%s\n",s);
    
    return 0;
}

Measured memory_bytes: 524
#include <stdio.h>

int main()
{
    int a, b, c, d, e, k;
    scanf("%d %d %d %d %d %d", &a, &b, &c , &d, &e, &k);
    
    if (e - a > k)
    {
        printf(":(\n");
    }
    else
    {
        printf("Yay!\n");
    }
    
return 0;
}

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

const long long maxN = 100000;
long long N;
vector<long long> V(3);
vector<int> ans(maxN,-1);

int compare(string s){
  int ret=-2;
  if(s=="AB"){
    if(V[0]>V[1]) ret = 1;
    else if(V[0]<V[1]) ret = 0;
    else ret = -1;
  }
  if(s=="AC"){
    if(V[0]>V[2]) ret = 2;
    else if(V[0]<V[2]) ret = 0;
    else ret = -1;
  }
  if(s=="BC"){
    if(V[1]>V[2]) ret = 2;
    else if(V[1]<V[2]) ret = 1;
    else ret = -1;
  }
  
  return ret;
}

void move(int plus, string s, int i){
  ans[i] = plus;
  V[plus]++;
  if(s=="AB") V[1-plus]--;
  if(s=="AC") V[2-plus]--;
  if(s=="BC") V[3-plus]--;
  return;
}

void yes(vector<int> &ans){
  cout << "Yes" << endl;
  for(int i=0;i<N;i++) cout << (char)('A' + ans[i]) << endl;
  return;
}

int main(){
  cin >> N >> V[0] >> V[1] >> V[2];
  vector<string> S(N+1,"");
  for(int i=0;i<N;i++) cin >> S[i];
  long long sum = V[0]+V[1]+V[2];
  
  if(sum==0){
    cout << "No" << endl;
  }
  
  else if(sum==1){
    for(int i=0;i<N;i++){
      int x = compare(S[i]);
      if(x==-1){
        cout << "No" << endl;
        return 0;
      }
      else move(x,S[i],i);
    }
    
    yes(ans);
  }
  
  else if(sum==2){
    for(int i=0;i<N;i++){
      int x = compare(S[i]);
      if(x==-1){
        if(V[S[i][0]-'A']==0){
          cout << "No" << endl;
          return 0;
        }
        else if(i==N-1 || S[i]==S[i+1]) move(S[i][0]-'A',S[i],i);
        else{
          if(S[i][0]=='A' && S[i+1][0]=='A') move(0,S[i],i);
          else if(S[i][1]=='C' && S[i+1][1]=='C') move(2,S[i],i);
          else move(1,S[i],i);
        }
      }
      else move(x,S[i],i);
    }
    
    yes(ans);
  }
  
  else{
    for(int i=0;i<N;i++){
      int x = compare(S[i]);
      if(x==-1){
        if(V[S[i][0]-'A']==0){
          cout << "No" << endl;
          return 0;
        }
        else move(S[i][0]-'A',S[i],i);
      }
      else move(x,S[i],i);
    }
    
    yes(ans);
  }
  return 0;
}


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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int n;
	string str;
	char p;
	
	cin >> n;
	cin >> str;
	
	int i = 0, cnt = 1;
	p = str[i++];
	while(str[i] == p && i < n){
		i++;
	}
	
	for(; i < n; i++){
		if(str[i] != p){
			cnt++;
			p = str[i++];
			while(i < n && str[i] == p){
				i++;
			}
			i--;
		}
	}
	
	cout << cnt << endl;
		
	return 0;
} 

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

int main() {
	char S[11], ans[11] = {'\0'};
	int i;
	scanf("%s", S);
	
	for (i = 0; i < strlen(S); i++) {
		 if (S[i] == 'B') 
		 	ans[strlen(ans) -1] = '\0';
		 else
			ans[strlen(ans)] = S[i];
	}
	printf("%s\n", ans);
	return 0;
}

Measured memory_bytes: 128
object Main {
  def main(args:Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val W = sc.nextInt
    val H = sc.nextInt
    val x = sc.nextInt
    val y = sc.nextInt
    val r = sc.nextInt
    println(if(x-r >= 0 && y-r >= 0 && x+r <= W && y+r <= H)"Yes" else "No")
  }
}

Measured memory_bytes: 44916
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

template<typename T>
T gcd(T a, T b)
{
    return b ? gcd(b, a % b) : a;
}

bool dfs(vector<ll>&a){
    int n = a.size();
    vector<ll>p(n),q(n);
    ll sm = 0;
    for(int i=0;i<n;i++){
        sm += a[i];
        if(i==0){
            p[i] = a[i];
        }else{
            p[i] = gcd(p[i-1],a[i]);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(i==n-1){
            q[i] = a[i];
        }else{
            q[i] = gcd(q[i+1],a[i]);
        }
    }
    bool flag = 0;
    rep(i,n){
        if(a[i]==1)continue;
        if(i==0){
            ll g = gcd(q[1],a[0]-1);
            ll x = (sm-1)/g;
            if((x-n)%2==0){
                if(g!=1){
                    vector<ll>b(n);
                    rep(j,n){
                        if(j!=i)b[j] = a[j]/g;
                        else b[j] = (a[j]-1)/g;
                    }
                    if(!dfs(b)){
                        flag = 1;
                    }
                }else{
                    flag = 1;
                }
            }
        }else if(i==n-1){
            ll g = gcd(p[n-2],a[n-1]-1);
            ll x = (sm-1)/g;
            if((x-n)%2==0){
                if(g!=1){
                    vector<ll>b(n);
                    rep(j,n){
                        if(j!=i)b[j] = a[j]/g;
                        else b[j] = (a[j]-1)/g;
                        
                    }
                    if(!dfs(b)){
                        flag = 1;
                    }
                }else{
                    flag = 1;
                }
            }
        }else{
            ll g = gcd(p[i-1],a[i]-1);
            g = gcd(g,q[i+1]);
            ll x = (sm-1)/g;
            
            if((x-n)%2==0){
                if(g!=1){
                    vector<ll>b(n);
                    rep(j,n){
                        if(j!=i)b[j] = a[j]/g;
                        else b[j] = (a[j]-1)/g;
                    }
                    if(!dfs(b)){
                        flag = 1;
                    }
                }else{
                    flag = 1;
                }
            }
        }
    }
    return flag;
}

int main(){
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n)cin >> a[i];
    if(dfs(a)){
        cout << "First" << endl;
    }else{
        cout << "Second" << endl;
    }
    return 0;
}

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

int main(){
  int a,b,c,d ;
  cin >> a >> b >> c >> d;
  
  int x = c - a;
  int y = d - b;
  
  cout << c - y << " " << d + x << " " << a - y << " " << b + x << endl;
  
  return 0;

}

Measured memory_bytes: 256
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
//#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 200100
//#define NIL -1

int main() {
    int n;
    int tmp4;
    int tmp7;
    bool ok=false;
    cin >> n;

    tmp4 = n/4;
    tmp7 = n/7;

    for(int i=0; i<=tmp4; i++){
        for(int j=0; j<=tmp7; j++){
            if(i*4+j*7==n){
                ok=true;
            }
        }
    }

    if(ok==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

def add(i, x):
    while i <= n:
        data[i] += x
        i += i & -i
def get(i):
    s = 0
    while i:
        s += data[i]
        i -= i & -i
    return s 

np = 1
data = [0]*(n+1)
fact = [1]*(n+1)
for i in range(1, n):
    fact[i] = (fact[i-1]*i)

for i, a in enumerate(p):
    v = a - get(a)
    add(a, 1)
    np += fact[n-i-1]*(v-1)

nq = 1
data = [0]*(n+1)
fact = [1]*(n+1)
for i in range(1, n):
    fact[i] = (fact[i-1]*i)

for i, a in enumerate(q):
    v = a - get(a)
    add(a, 1)
    nq += fact[n-i-1]*(v-1)

print(abs(np-nq))


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


int main() {
	int a, b, c;
	int temp;
	cin >> a >> b >> c;

	while (1) {
		if (a > b) {
			temp = a;
			a = b;
			b = temp;
		}
		if (b > c) {
			temp = b;
			b = c;
			c = temp;
		}
		if (a > b) {
			temp = a;
			a = b;
			b = temp;
		}

		if (a <= b &&b <= c) {
			cout << a << " " << b << " " << c << endl;
			return 0;
		}
		
	}
	return 0;
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n;
  set<vector<int> >ch;
  cin >> n;
  rep(i, n) {
    vector<int> p(3);
    cin >> p[0] >> p[1] >> p[2];
    sort(p.begin(), p.end());
    ch.insert(p);
  }
  cout << n - ch.size() << endl;
	return 0;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  string s;
  cin>>s;
  int n=s.size();
  if(s[n-1]=='s')
    cout<<s<<"es"<<endl;
  else 
    cout<<s<<"s"<<endl;
}

Measured memory_bytes: 3592
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    A = [[int(s) - 1 for s in reversed(readline().split())] for _ in range(N)]

    M = N * (N - 1) // 2
    games = 0
    players = set(range(N))

    for d in range(1, M + 1):
        players, players_prev = set(), players
        for i in players_prev:
            if not A[i] or i in players:
                continue
            j = A[i][-1]
            if j not in players and i == A[j][-1]:
                players.add(i)
                players.add(j)
                A[i].pop()
                A[j].pop()
                games += 1

        if games == M:
            print(d)
            break

        if not players:
            print(-1)
            break

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 41596
N = int(input())
A = map(int,input().split(" "))

b = []
i = 1
for a in A:
    b.append(a-i)
    i+=1

b.sort()

med = 0
if N % 2:
    med = b[N//2]
else:
    med = (b[N//2-1]+b[N//2])//2

abs = lambda x : x if x > 0 else -x
sad = lambda x : abs(x - med)
print(sum(map(sad,b)))

Measured memory_bytes: 26180
#include <iostream>
#include <string>
#include <list>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main(){
  int N, P;
  cin >> N >> P;
  string S;
  cin >> S;
  if(P == 2 || P == 5) {
    LL ret = 0;
    REP(i, N) {
      int c = S[i] - '0';
      if(c % P == 0) {
        ret += i + 1;
      }
    }
    cout << ret << endl;
  } else {
    LL amari[10000] = {1};
    int camari = 0, cketa = 1;
    for(int i=N-1; i>=0; --i) {
      int c = S[i] - '0';
      camari = (camari + c * cketa) % P;
      amari[camari]++;
      cketa = cketa * 10 % P;
    }
    LL ret = 0;
    REP(i, P) {
      ret += amari[i] * (amari[i] - 1) / 2;
    }
    cout << ret << endl;
  }
}

Measured memory_bytes: 644
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {
    int N; cin >> N;
    int ans = 0;

    for (int i = 1; i <= N; i++) {
        if (i % 2 != 0) {
            int div = 0;
            for (int j = 1; j <= i; j++) {
                if (i % j == 0)
                    div++;
            }
            if (div == 8)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <functional>
#include <sstream>
#include <bitset>
#include <map>

using namespace std;

typedef long long ll;
// const ll MOD = 1000000007;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) { // 強連結成分のサイズ
        return -par[root(x)];
    }
};

int main() {
  int N,M;
  cin>>N>>M;
  UnionFind tree(N);
  int ans = 0;
  for (int i = 0; i < M; i++) {
    int x,y,z;
    cin>>x>>y>>z;
    x--; y--;
    tree.merge(x,y);
  }
  for (int i = 0; i < N; i++) {
    if (tree.par[i] < 0) ans++;
  }
  cout<<ans<<endl;
  return 0;
}

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

bool match_two_num(int a, int b, int m)
{
  bool flag = false;

  for (int i = 0; i <= m / a; i++)
  {
    if ((m - a * i) % b == 0)
    {
      flag = true;
      break;
    }
  }
  return (flag);
}

int main()
{
  int A, B, C, D, E, F, max_sg;
  int ans_sg = 0, ans_wg = 0;

  cin >> A >> B >> C >> D >> E >> F;
  for (int i = 100 * A; i < F; i += 100)
  {
    if (!match_two_num(100 * A, 100 * B, i))
      continue;
    max_sg = min(F - i, i * E / 100);
    for (int j = max_sg; j >= 1; j--)
    {
      if (!(ans_sg * (j + i) < j * (ans_sg + ans_wg) || (ans_sg == 0 && j != 0)))
        continue;
      if (!match_two_num(C, D, j))
        continue;
      ans_sg = j;
      ans_wg = i;
    }
  }
  if (ans_wg == 0)
    ans_wg = 100 * A;
  cout << ans_wg + ans_sg << " " << ans_sg << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(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 ll inf = 1020304050607080910;
const int INF = 2000000000;
const ll mod = 1000000007;
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 x; cin >> x;
	ll p = gcd(360, x);
	ll q = 360*x/p;
	cout << q/x << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

#define REP(k, n) for (ll k = 0; k < (ll)(n); ++k)
#define REPREV(k, n) for (ll k = (ll)(n)-1; k >= 0; --k)
#define FOR(k, a, b) for (ll k = (ll)(a); k < (ll)(b); ++k)
#define FORREV(k, a, b) for (ll k = (ll)(b)-1; k >= (ll)(a); --k)
#define FOREACH(e, v) for (auto& e : v)

#define TGET(t, i) get<i>(t)
#define TSET(t, i, a) get<i>(t) = a
// MinHeap - priority_queue<ll, vll, greater<ll>> pq;

#define EVEN(n) ((n)&1) == 0
#define ODD(n) ((n)&1) == 1

#define SORT(v) sort(v.begin(), v.end())
#define SORTREV(v) sort(v.rbegin(), v.rend())
#define SHUFFLE(v) random_shuffle(v.begin(), v.end())
//srand(unsigned(time(0)));

#define REMOVEAT(v, i) v.erase(v.begin() + i)
#define REVERSE(v) reverse(v.begin(), v.end())
#define UNIQUE(v) \
    SORT(v);      \
    v.resize(distance(v.begin(), unique(v.begin(), v.end())))

ostream& operator<<(ostream& str, const pll& p) {
    str << p.first << " " << p.second;
    return str;
}

template <typename T>
void join(T& arr, string sep) {
    bool first = true;
    for (auto t : arr) {
        if (first) {
            first = false;
            cout << t;
        } else {
            cout << sep << t;
        }
    }
    cout << "\n";
}

const ll md = 1e9 + 7;
ll MOD(ll x) {
    ll r = x % md;
    if (r < 0) {
        r += md;
    }
    return r;
}

#define POS "POSSIBLE"
#define IMPOS "IMPOSSIBLE"

// #define INF DBL_MAX
// #define INF LLONG_MAX
// #define MINF LLONG_MIN
#define INF 1e18
#define MINF -INF

void solve() {
    ll n;
    cin >> n;
    ll res = 0;
    vector<pll> points(n);
    REP(i, n) {
        cin >> points[i].first;
        cin >> points[i].second;
    }

    ll mx = -INF;
    ll mn = INF;
    REP(i, n) {
        ll sm = points[i].first + points[i].second;
        mn = min(mn, sm);
        mx = max(mx, sm);
    }
    res = mx - mn;

    mx = -INF;
    mn = INF;
    REP(i, n) {
        ll sm = points[i].first - points[i].second;
        mx = max(mx, sm);
        mn = min(mn, sm);
    }
    res = max(res, mx - mn);


    mx = -INF;
    mn = INF;
    REP(i, n) {
        ll sm = -points[i].first + points[i].second;
        mx = max(mx, sm);
        mn = min(mn, sm);
    }
    res = max(res, mx - mn);

    mx = -INF;
    mn = INF;
    REP(i, n) {
        ll sm = -points[i].first - points[i].second;
        mx = max(mx, sm);
        mn = min(mn, sm);
    }
    res = max(res, mx - mn);

    // cout << fixed << setprecision(6);
    cout << res << "\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    // cin >> tt;
    for (int t = 1; t <= tt; t++) {
        // cout << "Case #" << t << ": ";
        solve();
    }
    //cin.rdbuf()->in_avail()
    return 0;
}

Measured memory_bytes: 6356
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const long double EPS = 1e-10;

class Point {
  public:
  long double x, y;

  Point(long double x = 0, long double y = 0): x(x), y(y) {}

  Point operator + (Point &p) {
    return Point(x + p.x, y + p.y);
  }

  Point operator - (Point &p) {
    return Point(x - p.x, y - p.y);
  }

  Point operator * (long double k) {
    return Point(x * k, y * k);
  }

  Point operator / (long double k) {
    return Point(x / k, y / k);
  }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }
};

long double norm(Point p) {
  return p.x * p.x + p.y * p.y;
}

long double abs(Point p) {
  return sqrt(norm(p));
}

long double dot(Point p1, Point p2) {
  return p1.x * p2.x + p1.y * p2.y;
}

long double cross(Point p1, Point p2) {
  return p1.x * p2.y - p1.y * p2.x;
}

int ccw(Point p0, Point p1, Point p2) {
  Point v1 = p1 - p0, v2 = p2 - p0;
  if (cross(v1, v2) > 0) return 1;
  else if (cross(v1, v2) < 0) return -1;
  else if (dot(v1, v2) < 0) return 2;
  else if (norm(v1) < norm(v2)) return -2;
  else return 0;
}

bool intersect(Point p1, Point p2, Point p3, Point p4) {
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

long double getDistanceLP(Point p1, Point p2, Point p3) {
  return fabs(cross(p2-p1, p3-p1) / abs(p2-p1));
}

long double getDistanceSP(Point p1, Point p2, Point p3) {
  if (dot(p2-p1, p3-p1) < 0) return abs(p3-p1);
  else if (dot(p1-p2, p3-p2) < 0) return abs(p3-p2);
  else return getDistanceLP(p1, p2, p3);
}

long double getDistanceTS(Point p1, Point p2, Point p3, Point p4) {
  if (intersect(p1, p2, p3, p4)) return 0;
  long double ans = INF;
  ans = min(ans, getDistanceSP(p1, p2, p3));
  ans = min(ans, getDistanceSP(p1, p2, p4));
  ans = min(ans, getDistanceSP(p3, p4, p1));
  ans = min(ans, getDistanceSP(p3, p4, p2));
  return ans;
}

class Circle {
  public:
  Point p;
  long double r;
};

int main() {
  Circle c;
  int q;
  Point p1, p2, h, a1, a2;
  long double d, t;
  cin >> c.p.x >> c.p.y >> c.r >> q;
  rep(i, q) {
    cin >> p1.x >> p1.y >> p2.x >> p2.y;
    h = (p2 - p1) * dot(c.p - p1, p2 - p1) / norm(p2 - p1) + p1;
    d = getDistanceLP(p1, p2, c.p);
    t = sqrt(c.r * c.r - d * d);
    a1 = (p2 - p1) * t / abs(p2 - p1);
    a2 = h - a1;
    a1 = h + a1;
    if (equals(a1.x, 0)) a1.x = 0;
    if (equals(a1.y, 0)) a1.y = 0;
    if (equals(a2.x, 0)) a2.x = 0;
    if (equals(a2.y, 0)) a2.y = 0;
    cout << setprecision(20) << min(a1, a2).x << " " << min(a1, a2).y << " ";
    cout << setprecision(20) << max(a1, a2).x << " " << max(a1, a2).y << endl;
  }

  
  return 0;
}


Measured memory_bytes: 3304
#include<stdio.h>
#include<stdlib.h>

int main(){
	int nn;
	int n;	/* 整数 */
	int ns;	/* 素因数 */
	int j;	/* 乗数 */
	int i;
	int* data;
	long long int sum = 1;

	scanf("%d",&nn);
	data = (int*)calloc(nn+1,sizeof(int));

	for(i=2; i<nn+1; i++){
		data[i] = 1;
	}

	for(i=nn; i>0; i--){
		n = i;
		for(ns=2; ns<=n; ns++){
			j = 0;
			while( n%ns == 0 ){
				n /= ns;
				j++;
			}

			if( j != 0 ) data[ns] += j;
		}
	}

	for(i=2; i<nn+1; i++){
		sum = (sum * data[i])%1000000007;
	}

	printf("%lld\n",sum);

	return 0;
}

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

int main(){
  int n,m,c;cin >> n >> m >> c;
  int b[m];rep(i,m)cin >> b[i];
  int a[n][m];
  rep(i,n){
    rep(j,m){
      cin >> a[i][j];
    }
  }

  int ans = 0;
  for(int i=0;i<n;++i){
    int sum = c;
    for(int j=0;j<m;++j){
      sum += b[j]*a[i][j];
    }
    if(sum > 0)ans += 1;
  }
  cout << ans << endl;
  return 0;
}

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

int main()
{
    long long int a[3],k;
    cin>>a[0]>>a[1]>>a[2]>>k;
    int sum=0;
    for(int i=0;i<=2;i++)
    {
        if(k<=0)
        break;
        if(i==0)
        sum+=min(k,a[i]);
        if(i==2)
        sum-=min(k,a[i]);
        k-=min(k,a[i]);
    }
    cout<<sum;
}

Measured memory_bytes: 3592
#include <stdio.h>

int main() {
    int i, j, k;
    int n, m, l;
    int matrixnm[101][101] = {0};
    int matrixml[101][101] = {0};
    long matrixnl[101][101] = {0};
    
    scanf("%d %d %d\n", &n, &m, &l);
    
    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            scanf("%d", &matrixnm[i][j]);
        }
    }
    
    for(i = 0; i < m; i++){
        for(j = 0; j < l; j++){
            scanf("%d", &matrixml[i][j]);
        }
    }
    
    for(i = 0; i < n; i++){
        for(j = 0; j < l; j++){
            for(k = 0; k < m; k++){
                matrixnl[i][j] += (matrixnm[i][k] * matrixml[k][j]);
            }
        }
    }
    
    for(i = 0; i < n; i++){
        for(j = 0; j < l; j++){
            printf("%ld", matrixnl[i][j]);
            if(j != (l - 1)){
                printf(" ");
            }
        }
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 2120
#include <stdio.h>
#include <math.h>
 
#define MAX 1000
 
int main(void)
{
    int i;
 
    while (1) {
        int n_students;
        scanf(" %d", &n_students);
 
        if (n_students == 0) {
            break;
        } else {
            int points[MAX];
            for (i = 0; i < n_students; i++) {
                scanf(" %d", &points[i]);
            }
 
            double ave = 0;
            for (i = 0; i < n_students; i++) {
                ave += points[i];
            }
            ave /= n_students;
 
            double variance = 0;
            for (i = 0; i < n_students; i++) {
                variance += pow(points[i] - ave, 2);
            }
            variance /= n_students;
 
            double deviation = sqrt(variance);
 
            printf("%f\n", deviation);
        }
    }
 
    return 0;
}

Measured memory_bytes: 636
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;

using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int l; cin >> l;
    float h = l/3.0;
    float v = pow(h,3);
    cout << setprecision(14) << v << "\n";
}



Measured memory_bytes: 256
n=int(input())
s=list(input())
t=list(input())
s.reverse() 
s_bottom=[]
t_head=[]
val=[n*2]
for i in range(n):
	s_bottom.append(s[i])
	t_head.append(t[i])
	s_bottom.reverse()
	if s_bottom!=t_head:
		s_bottom.reverse()
		continue
	else:
		val.append(n*2-len(t_head))
		
print(min(val))

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

int n;
int a[23][23];
LL dp[1<<16];

LL doit(int bit) {
	if (dp[bit] != -1) return dp[bit];
	dp[bit] = 0;
	int p[16],cp = 0;
	for (int i=0; i<n; i++) {
		if ((1<<i) & bit) {
			p[cp++] = i;
		}
	}
	for (int i=0; i<cp; i++) {
		for (int j=i+1; j<cp; j++) {
			dp[bit] += a[p[i]][p[j]];
		}
	}
	//printf("Yo %d = %lld\n",bit,dp[bit]);
	for (int i=(bit-1)&bit; i; i=(i-1)&bit) {
		dp[bit] = max(dp[bit],doit(i)+doit(i^bit));
	}
	return dp[bit];
}

int main() {
	scanf("%d",&n);
	for (int i=0; i<n; i++) {
		for (int j=0; j<n; j++) {
			scanf("%d",&a[i][j]);
		}
	}
	memset(dp,-1,sizeof(dp));
	printf("%lld\n",doit((1<<n)-1));
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define sz(x) int(x.size())
#define pb push_back
#define int long long

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1e9 + 7;

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	int sum = 0;
	for (int i = 1; i <= n; ++i) {
		if (i%3 && i%5)
			sum += i;
	}
	cout << sum;
}

Measured memory_bytes: 3644
import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2/22/20
 */
public class Main {

    private int N;
    private int[][] G;
    private final int MAX = Integer.MAX_VALUE;

    private boolean[] visit;
    public int[] d;

    public Main(Scanner sc) {
        N = sc.nextInt();
        G = new int[N][];
        for (int i = 0; i < N; i++) {
            G[i] = new int[N];
            for (int j = 0; j < N; j++) {
                int e = sc.nextInt();
                if (e == -1) {
                    e = MAX;
                }
                G[i][j] = e;
            }
        }

        visit = new boolean[N];
        d = new int[N];
        for (int i = 0; i < N; i++) {
            d[i] = MAX;
        }
    }

    public int prim() {
        for (int i = 0; i < N; i++) {
            d[i] = MAX;
        }
        d[0] = 0;

        int ans = 0;
        while(true) {
            // 找到下一个放入的结点
            int nextNode = -1;
            for (int i = 0; i < N; i++) {
                if (!visit[i] && (nextNode == -1 || d[i] < d[nextNode])) {
                    nextNode = i;
                }
            }

            if (nextNode == -1) break;

            ans += d[nextNode];
            visit[nextNode] = true;
            // 更新数组d
            for (int i = 0; i < N; i++) {
                d[i] = Math.min(d[i], G[i][nextNode]);
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.prim();
        System.out.println(res);
    }
}


Measured memory_bytes: 41376
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
ll P(int a, int b){return (((ll)a)<<32)+b;}
int check(int i){
    for(;i>1;i/=10)if(i%10!=0)return 0;
    return 1;
}
int st(int i){
    int tmp = 1;
    for(;tmp*10<=i;tmp*=10);
    return tmp;
}
int main(){
    int A, B;
    ll MOD;
    while(cin>>A>>B>>MOD, A){
        map<ll, ll> mp;
        ll ans = 0LL;
        for(int i=A;i<=B;i++){
            ll tmp = 1LL;
            if(!check(i)){
                tmp = (tmp + mp[P(st(i),i-1)])%MOD;
            }
            for(int j=i/10;j;j/=10){
                tmp = (tmp + mp[P(st(j),j)])%MOD;
            }
            ans = (ans+tmp)%MOD;
            if(check(i)){
                mp[P(i, i)] = tmp;
            }
            else{
                mp[P(st(i), i)] = (mp[P(st(i), i-1)] + tmp) % MOD;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 9944
N, MOD = int(input()), 10 ** 9 + 7
memo = [{} for i in range(N+1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True
def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret
print(dfs(0, 'TTT'))


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

int main()
{
  int n,odd;
  cin>>n;
  
  if(n%2==0)
    odd=n/2;
  
  else
    odd=n/2+1;
  
  float res = (float)odd/(float)n;
  
  cout<<res<<endl;
}



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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  REP(i, N)
  cin >> A[i];
  REP(i, N)
  cin >> B[i];
  int ans = 0;
  ll shotage = 0;
  vector<ll> vc;
  REP(i, N)
  {
    if (A[i] < B[i])
    {
      ans++; // A_i < B_i の場合は必ず A_i != C_i となる
      shotage += B[i] - A[i];
    }
    else
      vc.push_back(A[i] - B[i]);
  }
  if (ans == 0) // A_i < B_i となるiが存在しなかった → 準備度の変更をする必要がない
  {
    cout << ans << endl;
    return 0;
  }
  sort(ALL(vc));
  reverse(ALL(vc));
  REP(i, vc.size())
  {
    ans++;
    shotage -= vc[i];
    if (shotage <= 0)
      break;
  }
  if (0 < shotage) // A_i >= B_i を満たす組を全て使っても不足分を補えなかった
  {
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2936
#include<bits/stdc++.h>
using namespace std;
int direx[4] = {1, 0, -1, 0};
int direy[4] = {0, 1, 0, -1};
int a, b;
string mapo[100];
int BFS(int fx, int fy)
{
	queue<int> Q; Q.push(fx); Q.push(fy);
	int visit[a + 50][b + 50], mx = 0;
	memset(visit, 0, sizeof(visit));
	visit[fx][fy] = 1;
	while(!Q.empty())
	{
		int x = Q.front(); Q.pop();
		int y = Q.front(); Q.pop();
		for(int i=0; i<4; i++)
		{
			int tx = x + direx[i];
			int ty = y + direy[i];
			if(tx >= a || tx < 0) continue;
			if(ty >= b || ty < 0) continue;
			if(visit[tx][ty]) continue;
			if(mapo[tx][ty] == '#') continue;
			visit[tx][ty] = visit[x][y] + 1;
			Q.push(tx); Q.push(ty);
			mx = max(mx, visit[tx][ty]);
		}
	}
//	for(int i=0; i<a; i++)
//	{
//		for(int j=0; j<b; j++)
//			cout << visit[i][j] << ' ';
//		cout << '\n';
//	}
//	cout << '\n';
	return mx - 1;
}
int main()
{
	cin >> a >> b;
	for(int i=0; i<a; i++)
		cin >> mapo[i];
	int ans = 0;
	for(int i=0; i<a; i++)
	{
		for(int j=0; j<b; j++)
		{
			if(mapo[i][j] == '#') continue;
			ans = max(ans, BFS(i, j));
		}
	}
	cout << ans << '\n';
}

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

int main() {
    int n, v[30], c[30];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> v[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    

    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] > c[i]) ans += v[i] - c[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 3592
import sys
from collections import Counter
import bisect


# \n
def input():
    return sys.stdin.readline().rstrip()


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

    W_max =0
    W_min= 10**9+7
    Y_max= -10**9-1
    Y_min=10**9+7

    for i in range(N):
        x,y =map(int,input().split())
        W_max =max(W_max,x+y)
        W_min =min(W_min,x+y)
        Y_max =max(Y_max,x-y)
        Y_min =min(Y_min,x-y)

    print(max(W_max - W_min,Y_max - Y_min))






if __name__ == "__main__":
    main()


Measured memory_bytes: 68616
x = input()
y = input()
list = y.split()
even_list = []
result = ''

for i in list:
  i = int(i)
  if i % 2 == 0:
    even_list.append(i)
  else:
    result = "APPROVED"
    
for y in even_list:
  if y % 3 == 0 or y % 5 == 0:
    result = "APPROVED"
  else:
    result = "DENIED"
    break
    
print(result)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
long long solve(string t) {
	int sumj = 0, sumi = 0;
	for(int i = 0; i < t.size(); i++) {
		if(t[i] == 'I') sumi++;
	}
	long long ret = 0;
	for(int i = 0; i < t.size(); i++) {
		if(t[i] == 'O') ret += 1LL * sumj * sumi;
		if(t[i] == 'J') sumj++;
		if(t[i] == 'I') sumi--;
	}
	return ret;
}
int n; string s;
int main() {
	cin >> n >> s;
	long long retj = solve("J" + s);
	long long reti = solve(s + "I");
	long long ret = max(retj, reti);
	long long sum = solve(s);
	int sumj = 0, sumi = 0;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'I') sumi++;
	}
	for(int i = 0; i < n; i++) {
		ret = max(ret, sum + 1LL * sumj * sumi);
		if(s[i] == 'J') sumj++;
		if(s[i] == 'I') sumi--;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3240
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;




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

	int G[310][310];
	int N;
	cin >> N;

	
	int A[310][310] = { 0 };
	int B[310][310] = { 0 };

	REP(i, N) {
		REP(j, N) {
			cin >> A[i][j];
		}
	}
	
	REP(i, N) {
		REP(j, N) {
			REP(k, N) {
				if (A[i][j] > A[i][k] + A[k][j]) {
					cout << -1 << endl;
					return 0;
				}

				if (A[i][j] == A[i][k] + A[k][j] && A[i][k] > 0 && A[k][j]) {
					B[i][j] = true;
				}
			}
		}
	}
	int ans = 0;
	REP(i, N) {
		eREP(j, i) {
			if (B[i][j] == 0)ans += A[i][j];
		}
	}

	cout << ans << endl;

	return 0;
}



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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int n;
	cin >> n;
	vi p(n);
	rep(i, n) cin >> p[i];

	int mn = inf;
	int cnt = 0;
	rep(i, n) {
		if (p[i] < mn) {
			cnt++;
			mn = min(mn, p[i]);
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=100010;

ll n,k;
ll ar[101];

int dp[N][2];

int func(ll w,int t)
{
    if(w<=0){return t;}

    if(dp[w][t]==-1){
    int ans;
    if(t==0)
    {
        ans=0;
        for(ll i=0;i<n;++i)
        {
            if(w-ar[i]>=0)
            {
                ans|=func(w-ar[i],1);
            }
        }
    }
    else
    {
        ans=1;
        for(ll i=0;i<n;++i)
        {
            if(w-ar[i]>=0)
            {
                ans&=func(w-ar[i],0);
            }
        }
    }
    dp[w][t]=ans;
    }
    return dp[w][t];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n>>k;
    for(ll i=0;i<n;++i){cin>>ar[i];}
    memset(dp,-1,sizeof(dp));
    int ans=func(k,0);

    if(ans){cout<<"First";}
    else{cout<<"Second";}

    return (0);
}


Measured memory_bytes: 5760
n,m= map(int,input().split())
AA = list(map(int,input().split()))
A = [(AA[i],1) for i in range(n)]
for _ in range(m):
  b,c = map(int,input().split())
  A += [(c,b)]
A.sort()
A.reverse()
rest = n
score = 0
for (cc,bb) in A:
  use = min(bb,rest)
  rest -= use
  score += use*cc
print(score)

Measured memory_bytes: 28888
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int calc(int m,int *cnt,int len){
  if(m==1) return 1;
  if(m>1 && len==0) return 0;
  int res=calc(m,cnt,len-1);
  int d[]={3,5,15,25,75};
  int i;
  for(i=0;i<5;i++){
    if(m%d[i]==0 && cnt[len-1]+1>=d[i]){
      res+=calc(m/d[i],cnt,len-1);
    }
  }
  return res;
}

void run(void){
  int n;
  scanf("%d",&n);
  int p[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
  int cnt[15]={};
  int i;
  for(i=0;i<15;i++){
    int t=n;
    cnt[i]=0;
    while(t>=p[i]){
      cnt[i]+=t/p[i];
      t/=p[i];
    }
  }
  int ans=calc(75,cnt,15);
  printf("%d\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

def enum_prime(m):
    L = [True for _ in xrange(m + 1)]
    L[0] = L[1] = False

    for i in xrange(2, m + 1):
        if L[i]:
            for j in xrange(i + i, m + 1, i):
                L[j] = False
            if m < i * i:
                break
    return L

FLAGS = enum_prime(50000)
PRIMES = [i for i, isprime in enumerate(FLAGS) if isprime]

for line in stdin:
    if line.startswith('0'):
        break
    n = int(line)
    n2 = n // 2
    cnt = 0
    if n % 2 == 0:
        for p in PRIMES:
            if p > n2:
                break
            if FLAGS[n - p]:
                cnt += 1
    elif FLAGS[n - 2]:
        cnt = 1
    print(cnt)

Measured memory_bytes: 4664
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
constexpr ll INF = 1e18;

int main(void) {
    int N;
    cin >> N;
    vector<int> P(N), Q(N);
    for (int i = 0; i < N; ++i) {
        cin >> P[i];
    }
    for (int i = 0; i < N; ++i) {
        cin >> Q[i];
    }
    vector<int> v(N);
    iota(v.begin(), v.end(), 1);
    int a, b;
    int i = 0;
    do {
        if (v == P) a = i;
        if (v == Q) b = i;
        i++;
    } while(next_permutation(v.begin(), v.end()));
    cout << abs(a-b) << endl;
    return 0;
}



Measured memory_bytes: 256
import math

N, M = map(int, input().split())
a = 1
if N == M:
    # for i in range(1, N + 1):
    #     a *= i
    #     if a >= 10 ** 9 + 7:
    #         a -= 10 ** 9 + 7
    #    a = cai(N)
    # print((a * a * 2) )
    print(((math.factorial(N) % (10 ** 9 + 7)) ** 2 * 2) % (10 ** 9 + 7))
elif N == M + 1 or N + 1 == M:
    M, N = max(N, M), min(N, M)
    # for i in range(1, m + 1):
    #    a *= i
    # print((a * a * max(N, M)) % (10 ** 9 + 7))
    print(((math.factorial(N) % (10 ** 9 + 7)) ** 2 * M) % (10 ** 9 + 7))
else:
    print(0)


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

int main(){
    int N;
    cin >> N;
    vector<string> vec(N);
    int C0 = 0;
    int C1 = 0;
    int C2 = 0;
    int C3 = 0;
    for(int i = 0; i < N; i++){
        cin >> vec.at(i);
        if (vec.at(i) == "AC")
            C0++;
        else if (vec.at(i) == "WA")
            C1++;
        else if (vec.at(i) == "TLE")
            C2++;
        else if (vec.at(i) == "RE")
            C3++;
    }
    cout << "AC x " << C0 << endl;
    cout << "WA x " << C1 << endl;
    cout << "TLE x " << C2 << endl;
    cout << "RE x " << C3 << endl;
}

Measured memory_bytes: 6352
import heapq
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, M = list(map(int, sys.stdin.readline().split()))
A = list(map(int, sys.stdin.readline().split()))
A = [-a for a in A]

heapq.heapify(A)

for _ in range(M):
    heapq.heapreplace(A, A[0] / 2)

ans = 0
for a in A:
    ans += int(a)
print(-ans)


Measured memory_bytes: 83992
#include <stdio.h>
int main(void){
  int a,b,c,d,e,k;
  if(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k)<6) return 1;
  if(e-a>k){
    printf(":(\n");
  }
  else{
    printf("Yay!\n");
  }
    return 0;
}

Measured memory_bytes: 128
N = int(input())
D = {}
for n in range(2, N+1):
    K = n
    for k in range(2, n):
        if k not in D:
            continue
        while K % k == 0:
            K //= k
            D[k] += 1
        if K == 1:
            break
    else:
        D[n] = 1
a2 = sum(v >= 2 for v in D.values())
a4 = sum(v >= 4 for v in D.values())
a14 = sum(v >= 14 for v in D.values())
a24 = sum(v >= 24 for v in D.values())
a74 = sum(v >= 74 for v in D.values())
ans = 0
if a2 > 2:
    ans += (a2-2)*a4*(a4-1)//2
if a2 > 1:
    ans += (a2-1)*a24
if a4 > 1:
    ans += (a4-1)*a14
if a74:
    ans += a74
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int a,b,c,k;
    cin>>a>>b>>c>>k;
    std::deque<long long int> deq;
    deq.emplace_back(a);
    deq.emplace_back(b);
    deq.emplace_back(c);
    long long int sum=0;
    for (int i=0;k>0;i++) {
        if (deq[i]<=k) {
            k-=deq[i];
            if (i==0) {
                sum+=deq[i];
            } else if (i==2) {
                sum-=deq[i];
            }
        } else {
            if (i==0) {
                sum+=k;
            } else {
                sum-=k;
            }
            break;
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3632
from numba import njit

@njit
def solve(k):
    num = 0
    ans = -1
    for i in range(10 ** 7):
        num *= 10
        num += 7
        num %= k
        if num == 0:
            ans = i + 1
            break

    return ans


k = int(input())
ans = solve(k)
print(ans)


Measured memory_bytes: 108696
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

int main(){
    int N;cin>>N;
    vec A(110);
    for(int i=0;i<N;i++){
        cin>>A[i];
        if(A[i]%2==0 && A[i]%3!=0 && A[i]%5!=0){
            cout<<"DENIED"<<endl;
            return 0;
        }
    }
    cout<<"APPROVED"<<endl;
    return 0;
}

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

int main(){
	int n ; cin >> n ;
	map<int,int> m ;
	for(int i=0;i<n;i++){
		int d ; cin >> d ;

		m[d]++ ;
	}
	cin >> n ;
	for(int i=0;i<n;i++){
		int t ; cin >> t ;
		if(m[t]==0){
			cout << "NO" << endl ;
			return 0 ;
		}else{
			m[t]-- ;
		}
	}
	cout << "YES" << endl ;
}


Measured memory_bytes: 9600
N = int(input())

colormap = {'R':0,'G':1,'B':2}
S = [colormap[c] for c in input()]

bads = 0
for i in range(N):
    for s in range(1,(N-i+1)//2):
        bads += int(S[i]^S[i+s]^S[i+2*s] == 3)

totals = [0]*3
for c in S:
    totals[c] += 1

print(totals[0]*totals[1]*totals[2] - bads)

Measured memory_bytes: 9200
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int INF = 1 << 25;
const LL MOD = 1000000007LL;
using namespace std;
LL v[50];
LL comb[51][51];
int main() {
	comb[0][0] = 1;
	for (int i = 1; i <= 50; i++) {
		comb[i][0] = comb[i][i] = 1;
		for (int j = 1; j < i; j++) {
			comb[i][j] = comb[i - 1][j - 1] + comb[i-1][j];
		}
	}
	int N, A, B;
	cin >> N >> A >> B;
	rep(i, N) cin >> v[i];
	sort(v, v + N);
	LL sum = 0;
	rep(i, A) sum += v[N - 1 - i];
	printf("%.15lf\n", (double)sum / A);
	int cnt = 0;
	rep(i, N) if (v[i] == v[N - A]) cnt++;
	LL ans = 0;
	if (v[N - A] == v[N - 1]) {
		for (int i = A; i <= B; i++) ans += comb[cnt][i];
	}
	else {
		int cnt2 = 0;
		rep(i, A) if (v[N - 1 - i] == v[N - A]) cnt2++;
		ans += comb[cnt][cnt2];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <numeric>

int main() {
  intmax_t h;
  size_t n;
  scanf("%jd %zu", &h, &n);

  std::vector<intmax_t> a(n);
  for (auto& ai: a) scanf("%jd", &ai);
  intmax_t res = std::accumulate(a.begin(), a.end(), 0);

  puts((res >= h)? "Yes": "No");
}


Measured memory_bytes: 1024