akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n;
  cin >> n;
  vector<ll> G[n];
  rep(i, n-1) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  queue<Pl> q;
  q.push(Pl(0, 0));
  q.push(Pl(n-1, 1));

  vector<ll> area(n, -1);
  area[0] = 0;
  area[n-1] = 1;

  vector<ll> cntwho(2, 0);

  while(!q.empty()) {
    ll pos = q.front().first;
    ll who = q.front().second;
    q.pop();

    rep(i, ll(G[pos].size())) {
      ll to =G[pos][i];
      if (area[to] != -1) continue;
      q.push(Pl(to, who));
      area[to] = who;
      cntwho[who]++;
    }
  }

  if (cntwho[0] > cntwho[1]) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;

  return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, k, r;

int main() {
	cin >> n >> k;
	if(k == 0){
		r = n*n;	
	}
	else{
		r = 0;
		for(ll i = k+1; i <= n; i++){
			r += (i-k)*((n-i)/i+1) + max(n%i-(k-1), (ll)0);
			//cout << i << " " << r <<endl;
		}
	}
	cout << r;
	return 0;
}

Measured memory_bytes: 256
S = input()
T = input()
ans = 999999
for i in range(len(S) - len(T) + 1):
  s = S[i:i + len(T)]
  score = 0
  for i in range(len(s)):
    if s[i] != T[i]:
      score += 1
  ans = min(ans, score)

print(ans)


Measured memory_bytes: 73680
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a,i = 1,ii = 0;
  cin >> a;

while(cin >> a){
if(a % 2 == 1 and i % 2 == 1){
ii++;
}
  i++;
}
  cout << ii;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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 MOD = 1e9 + 7;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    int X;
    cin >> X;
    int now = 400;
    int ans = 8;
    while (!(now <= X && X < now + 200)) {
        ans--;
        now += 200;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#include <cstdio>

int p[] = {-1,1};

int main()
{
	int a[4];
	for (int i = 0; i<4; i++){
		char c = getchar();
		a[i] = c - '0';
	}

	for (int i = 0; i<2; i++)
		for (int j = 0; j<2; j++)
			for (int k = 0; k<2; k++)
				if (a[0] + p[i]*a[1] + p[j]*a[2] + p[k]*a[3] == 7)
				{
					printf("%d",a[0]);
					printf("%c",i==0?'-':'+');
					printf("%d",a[1]);
					printf("%c",j==0?'-':'+');
					printf("%d",a[2]);
					printf("%c",k==0?'-':'+');
					printf("%d",a[3]);
					printf("=7\n");
					return 0;
				}
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n, m;
  cin >> n >> m;
  vector<vector<P>> ken(n+1);
  rep(i, m) {
    int p, y;
    cin >> p >> y;
    ken[p].emplace_back(y, i);
  }
  for(int i = 1; i <= n; ++i) sort(ALL(ken[i]));
  vector<string> ans(m);
  for(int i = 1; i <= n; ++i) {
    rep(j, ken[i].size()) {
      int index = ken[i][j].second;
      stringstream ss;
      ss << setw(6) << setfill('0') << i << setw(6) << setfill('0') << j+1;
      ans[index] = ss.str();
    }
  }
  for(auto x : ans) cout << x << endl;
}

Measured memory_bytes: 11968
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;cin >> n >> m;
  vector<ll> v(n);
  ll sum =0;
  rep(i,n){
    cin >> v[i];
    sum += v[i];
  }
  sort(all(v));
  reverse(all(v));
  if(v[m-1] >= (sum+ 4*m-1) / (4 * m)){
    cout << "Yes" << endl;
  }else{
    cout <<"No" <<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(ll u = 0, char c = getchar(), bool f = false) {
	for (;!isdigit(c); c = getchar()) f |= c == '-';
	for (; isdigit(c); c = getchar()) u = (u << 1) + (u << 3) + c - '0';
	return f ? -u : u;
}



int main() {
	ll a = read(), b = read(), c = read() * 2, x = read(), y = read();
	if (c >= a + b) cout << x * a + y * b << endl;
	else {
		ll ans = min(x, y);
		x -= ans, y -= ans;
		ans *= c;
		ans += min(a, c) * x;
		ans += min(b, c) * y;
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
n = gets.to_i
s = gets.split(" ").map(&:to_i)
count = 0

for i in 1..(n-2) do
  if s[i-1] < s[i] and s[i] < s[i+1]
    count += 1
  elsif s[i-1] > s[i] and s[i] > s[i+1]
    count += 1
  end
end    
puts count

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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(int i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;


int main() {
    int n,k; cin >> n >> k;
    int s[n] = {};
    rep(i,0,k){
        int d; cin >> d;
        int di;
        rep(j,0,d){
            cin >> di;
            s[di-1] = 1;
        }
        
    }
    int ans = 0;
    rep(i,0,n){
        if(s[i] == 0) ans++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 10;
int n, k, a[maxn];
ll s[maxn], t[maxn];
map <int, int > mp;

int main()
{
  scanf("%d%d",&n,&k);
  for(int i = 1; i <= n; i ++){
    scanf("%d",&a[i]);
    s[i] = s[i - 1] + a[i];
    s[i] = (s[i] + k) % k;
  }
  ll ans = 0;
  mp[0] = 1;
  int l = 0;
  for(int i = 1; i <= n; i ++){
    while(i - l >= k){
      mp[(s[l] - l % k + 3ll * k) % k] --;
      l ++;
    }
    ans += mp[(s[i] - i % k + 3ll * k) % k];
    mp[(s[i] - i % k + 3ll * k) % k] ++;
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 12032
#include<stdio.h>
int main()
{
 int s,i,p,max,x,y,a,b; 
 while(1){
    max=0;
    scanf("%d %d %d",&x,&y,&s);
    if(x==0 && y==0 && s==0){
    break;
    }
    for(i=1;i<=s-i;i++){
    for(p=s-i;i<=p;p--){
a=i*(100+x)*0.01;
b=p*(100+x)*0.01;
    if(a+b==s){
a=i*(100+y)*0.01;
b=p*(100+y)*0.01;
    if(a+b>max){
    max=a+b;
                    }}}}
        printf("%d\n",max);
    }}


Measured memory_bytes: 2040
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    REP(i, H) {
        REP(j, W) {
            char c;
            cin >> c;
            S[i][j] = c;
        }
    }
    vector<vector<int>> acc(H, vector<int>(W, 0));
    REP(i, H) {
        int l = 0, r = 0;
        while (r < W) {
            while (r < W && S[i][r] == '#') {
                r++;
            }
            l = r;
            while (r < W && S[i][r] == '.') {
                r++;
            }
            FOR(j, l, r, 1) {
                acc[i][j] = r - l;
            }
        }
    }
    REP(j, W) {
        int t = 0, b = 0;
        while (b < H) {
            while (b < H && S[b][j] == '#') {
                b++;
            }
            t = b;
            while (b < H && S[b][j] == '.') {
                b++;
            }
            FOR(i, t, b, 1) {
                acc[i][j] += b - t;
            }
        }
    }
    int res = 0;
    REP(i, H) {
        REP(j, W) {
            amax(res, acc[i][j] - 1);
        }
    }
    cout << res << endl;
    return 0;
}


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

#define MAX 1000
int S[MAX],top;

int isEmpty(){
  return top==0;
}

int isFull(){
  return top>=MAX-1;
}

void push(int x){
  if(isFull()){
    printf("Stack overflow\n");
    exit(2);
  }
  top++;
  S[top]=x;
}

int pop(){
  if(isEmpty()){
    printf("Stack is Empty\n");
    exit(3);
  }
  top--;
  return S[top+1];
}

int main(){
  int x,a,b;
  char s[100];
  top=0;
  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
  }
    else if(s[0]=='-'){
      a=pop();
      b=pop();
      push(b-a);
    }
    else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }
    else push(atoi(s));
  }
  printf("%d\n",pop());
  return 0;
}
    



Measured memory_bytes: 2108
#include <iostream>
#include <cmath>

int main() {
    int n, t, e, p;
    
    std::cin >> n >> t >> e;
    for(int i = 0; i < n; ++i) {
        std::cin >> p;
        
        if(std::abs(t - t / p * p) <= e || std::abs(t - (t / p + 1) * p) <= e) {
            std::cout << i + 1 << std::endl;
            
            return 0;
        }
    }
    
    std::cout << -1 << std::endl;

    return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    int alice = 0, bob = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) alice += a[i];
        else bob += a[i];
    }
    cout << alice - bob << endl;
}

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

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  if(a[a.size() -1] == b[0] && b[b.size() -1] == c[0]){
    cout << "YES";
  }
  else{
    cout << "NO";
  }
}

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

bool is_sosu(int n) {
	bool flag = true;
	for(int i=2;i*i<=n;i++) {
		if(n % i == 0)
			flag = false;
	}
	return flag;
}

int main(void) {
	int N;
	cin >> N;

	vector<int> sosu;
	
	int cnt = 0, num = 11;
	while(cnt <= 60) {
		if(is_sosu(num)) {
			sosu.push_back(num);
			cnt++;
		}
		num += 10;
	}
	for(int i=0;i<N;i++) {
		if(i==0) cout << sosu[i];
		else cout << " " << sosu[i];
	}
	putchar('\n');
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
string s;
int a,b,A,B;
int main(void){
    cin>>s;
    a=10*(s[0]-'0')+(s[1]-'0');
    b=10*(s[2]-'0')+(s[3]-'0');
    if(1<=a&&a<=12)A=1;
    if(1<=b&&b<=12)B=1;
    if(A&B)cout<<"AMBIGUOUS"<<endl;
    else if(A)cout<<"MMYY"<<endl;
    else if(B)cout<<"YYMM"<<endl;
    else cout<<"NA"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
ll n,k,a[maxn],sum[maxn],ans;
map<ll,ll> m;
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	rep(i,1,n){
		cin >> a[i];
		a[i] %= k;
	}
	m[0] = 1;
	rep(i,1,n){
		if(i >= k) {
			ll pre = (sum[i-k] - (i%k - k + k) % k + k) % k;
			if(m[pre] > 0) m[pre]--;
		}
		sum[i] = (sum[i-1] + a[i]) % k;
		ll tmp = (sum[i] - i % k + k) % k;
		ans += m[tmp];
		m[tmp]++;
	}
	cout << ans << endl;
	return 0;
}
//do smt instead of nothing! never give up!
//take care of long long!
//take care of upper or lower case e.g "yes" or "YES"?
//boundary condition! e.g. n = 0?
//brute force is always the first choice!
// print the ans to look for patterns in the data!

Measured memory_bytes: 15872
n = int(input())
A = list(map(int,input().split()))

ans = 0
l = 0
r = 0
bit = A[0]
total = A[0]

while True:  
  if bit == total:
    ans += r-l+1
    r += 1
    if r == n:
      break
    total += A[r]
    bit ^= A[r]
  else:
    total -= A[l]
    bit ^= A[l]
    l += 1
      
print(ans)      

Measured memory_bytes: 32064
// Ver19.02
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i, l, r) for (ll i = (l); i < (r); i++)
#define max(p, q) ((p) > (q) ? (p) : (q))
#define min(p, q) ((p) < (q) ? (p) : (q))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }

char s[220], t[110];
int main()
{
  scanf("%s%s", s, t);
  ll n = strlen(s);
  for (int i = 0; i < n; i++)
  {
    if (!strcmp(s + i, t))
    {
      puts("Yes");
      return 0;
    }
    s[n + i] = s[i];
  }
  puts("No");
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
char  s[210000];
int main ()
{   int n;
   cin>>n;
   scanf("%s",s+1);
   int sum=0;
   int R=0,W=0;
   for(int i=1;i<=n;i++)
   {  if(s[i]=='R') R++;
      else  W++;
   }
   sum=min(R,W);
   int ans=0;
   for(int i=n;i>=n-W+1;i--)
   {   if(s[i]=='R') ans++;
   }
   sum=min(sum,ans);
   cout<<sum<<endl;
   return 0;
}

Measured memory_bytes: 3936
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main() {
  int n,k,tmp,ans(0);
  cin >> n >> k;
  for(int i = 0;i < n;i++){
    cin >> tmp;
    if(tmp >= k)ans++;
  }
  cout << ans;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v { a, b, c };
    sort(all(v));
    cout << v[0] * v[1] / 2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int a,b;
  cin>>a>>b;
  if(a%2==1 && b%2==1) cout<<"Odd"<<endl;
  else cout<<"Even"<<endl;

  return 0;
}





Measured memory_bytes: 256
n=int(input())
flag=0
flag2=0
for r in range(n):
    x,y=map(int,input().split())
    if x==y:
        flag+=1
        if flag==3:
            flag2=1
    else:
        flag=0
if flag2==1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9172
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<cstdlib>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i,k) for(int i=0;i<k;i++)
ll n, m, i, j, k,o,l,z,sam=0,p,q;
ll a[100005] = {} , inf = 1000000000000;
ll b[100005] = {};
string s;
ll t[100005], xx[100005];
char ss,st;
int main() {
	z = 0; o = 0;
	cin >> n>>m ;
	rep(i, m) {
		cin >> p>>s;
		if (a[p] >= 1)continue;
		if (s == "AC") {
			a[p] = 1;
			z++;
			o += b[p];
		}
		else b[p]++;
	}

	 cout << z<<" "<<o;
	return 0;
}

Measured memory_bytes: 1792
import copy
N = int(input())
monster = list(map(int,input().split()))
warior = list(map(int,input().split()))
_monster = copy.copy(monster)

for index in range(N):
  x = warior[index]
  monster[index] = monster[index] - x
  if monster[index] < 0:
    monster[index+1] = monster[index+1] + monster[index]
    monster[index] = 0
    if monster[index+1] < 0:
      monster[index+1] = 0

print(sum(_monster)-sum(monster))

Measured memory_bytes: 86876
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;double a=0;cin>>n;
  for(int i=0;i<n;i++){
    double x;string u;cin>>x>>u;
    if(u=="BTC")x*=380000.0;
    a+=x;
  }
  cout<<a<<endl;
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define mp make_pair
#define All(v) v.begin(),v.end()
#define mod 1000000007

using namespace std;

int main()
{
    int h,w;
    cin >> h >> w;
    int r1,r2,r3;
    int h1,h2,h3;
    int w1,w2,w3;
    int res = 1e9;
    /// case 1
    w1 = w2 = w3 = w;
    h1 = h/3;
    h2 = (h-h1)/2;
    h3 = (h-h1-h2);

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    h1 = h/3;
    h2 = h-h1;
    h3 = h-h1;
    w1 = w;
    w2 = w/2;
    w3 = w-w2;

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    /// case 2
    h1 = h2 = h3 = h;
    w1 = w/3;
    w2 = (w-w1)/2;
    w3 = (w-w1-w2);

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    w1 = w/3;
    w2 = w-w1;
    w3 = w-w1;
    h1 = h;
    h2 = h/2;
    h3 = h-h2;

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    /// case 1
    w1 = w2 = w3 = w;
    h1 = h/3 + 1;
    h2 = (h-h1)/2;
    h3 = (h-h1-h2);

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    h1 = h/3 + 1;
    h2 = h-h1;
    h3 = h-h1;
    w1 = w;
    w2 = w/2;
    w3 = w-w2;

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    /// case 2
    h1 = h2 = h3 = h;
    w1 = w/3 + 1;
    w2 = (w-w1)/2;
    w3 = (w-w1-w2);

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    w1 = w/3 + 1;
    w2 = w-w1;
    w3 = w-w1;
    h1 = h;
    h2 = h/2;
    h3 = h-h2;

    res = min(res,max(h1*w1,max(h2*w2,h3*w3)) - min(h1*w1,min(h2*w2,h3*w3)));

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    solve(&buf);
}

fn solve(input: &str) {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut a: Vec<usize> = Vec::with_capacity(n);
    for _i in 0..n {
        a.push(iterator.next().unwrap().parse().unwrap());
    }

    let g = make_g(n);
    println!("{}", g.len());
    println!("{}", g.iter().map(|it| it.to_string()).collect::<Vec<String>>().join(" "));

    let cnt = shell_sort(&mut a, g);
    println!("{}", cnt);

    for ai in a {
        println!("{}", ai);
    }
}

fn make_g(n: usize) -> Vec<usize> {
    let mut result = Vec::new();

    let mut g = 1;
    while g <= n {
        result.insert(0, g);
        g = 3 * g + 1;
    }

    result
}

fn shell_sort(a: &mut Vec<usize>, g: Vec<usize>) -> usize {
    let mut cnt = 0;

    for i in 0..g.len() {
        cnt += insertion_sort(a, g[i]);
    }

    cnt
}

fn insertion_sort(a: &mut Vec<usize>, g: usize) -> usize {
    let mut cnt = 0;

    for i in g..a.len() {
        let v = a[i];
        let mut j: isize = i as isize - g as isize;
        while j >= 0 && a[j as usize] > v {
            a[j as usize + g] = a[j as usize];
            j = j - g as isize;
            cnt += 1;
        }
        a[(j + g as isize) as usize] = v;
    }

    cnt
}



Measured memory_bytes: 22392
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {//a>b
	if (a < b)swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
int main() {
	string S;
	cin >> S;
	if (S[2] == S[3] && S[4] == S[5])cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
# AOJ 0058 Orthogonal
# Python3 2018.6.15 bal4u

EPS = 1e-11

def dot(a, b):
	return a.real*b.real + a.imag*b.imag

def cross(a, b):
	return a.real*b.imag - a.imag*b.real
	
def norm(a):
	return a.real**2 + a.imag**2
	
def project(line, p):
	base = line[1]-line[0]
	r = dot(p-line[0], base) / norm(base)
	return line[0] + base*r
	
def symmetric_Point(line, p):
	return p + 2*(project(line, p)-p)

def isParallelLL(line1, line2):
	t = cross(line1[1]-line1[0], line2[1]-line2[0])
	return -EPS <= t and t <= EPS

def isOrthogonalLL(line1, line2):
	t = dot(line1[1]-line1[0], line2[1]-line2[0])
	return -EPS <= t and t <= EPS
	

while True:
	try: p = list(map(float, input().split()))
	except: break
	
	p1 = complex(p[0], p[1])
	p2 = complex(p[2], p[3])
	p3 = complex(p[4], p[5])
	p4 = complex(p[6], p[7])
	print('YES' if isOrthogonalLL([p1,p2], [p3,p4]) else 'NO')


Measured memory_bytes: 5600
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s=sc.next();
    //buffはsの先頭の数字に、9をつなげた数字になる。例：s=1234 -> buff=1999
    long buff=(Integer.valueOf(s.substring(0, 1))+1)*(long)Math.pow(10, s.length()-1)-1;
    if(Long.valueOf(s)==buff) {
    	 System.out.println(Integer.valueOf(s.substring(0, 1))+9*(s.length()-1));
    }else {
    	System.out.println(Integer.valueOf(s.substring(0, 1))-1+9*(s.length()-1));
    }
  }
}


Measured memory_bytes: 22100
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;
using Graph = vector<vector<ll>>; // グラフ型

int main()
{
    ll A,B;
    cin >> A >> B;
    ll res;

    if((A+B) %2 == 1)
    {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    res = (A + B) /2;
    
    cout << res << endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main() {
  int a[10000];
    int n,i,q,j,t,p=0,u=0,o=0;
  scanf("%d",&n);
  if(n<1 || 10000<n) exit(0);
  for(i=0;i<n;i++) {
    scanf("%d",&q);
    a[i]=q;
    if(q<2 || 100000000<q) exit(0);

    p=0;
    if(a[i]==2 ){ o++; continue;}
   if(a[i]%2==0) continue;
    for(j=3;j<=sqrt(a[i]);j+=2) {
    t=a[i]%j;
    if(t==0) p++; 
    }
    if(p==0)
    o++;
  }
    printf("%d\n",o);
    return 0;
  }
  


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

int main() {  
  int N, S;
  cin >> N;

  rep(i, N) {
    int l, r;
    cin >> l >> r;
    
    S += r - l + 1;
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll A,B,C,K;
    cin >>A>>B>>C>>K;
    ll res = K;
    ll flag = 0;
    if(A<B){
        flag = 1;
    }
    if(flag == 0){
        rep(i,K){
            B*=2;
            res--;
            if(A<B){
                flag=1;
                break;
            }
            
        }
    }
    if(flag == 1){
        rep(i,res){
            C*=2;
            if(B<C){
                cout << "Yes" << endl;
                return 0;
            }
            
    
        }
    }
    if(B<C){
        cout << "Yes" << endl;
        return 0;
    }
    
    cout << "No" << endl;


    return 0;
    

}

Measured memory_bytes: 3596
package main

import "fmt"

func main() {

	for {
		var s string
		fmt.Scan(&s)
		if s == "-" {
			break
		}

		var m int
		fmt.Scan(&m)

		for i := 0; i < m; i++ {
			var h int
			fmt.Scan(&h)
			s = s[h:] + s[:h]
		}

		fmt.Println(s)
	}
}



Measured memory_bytes: 1160
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<climits>
#include<cmath>  
#include<memory.h> 
#include<sstream>
#include<time.h>
#include<iomanip>
using namespace std;
const unsigned long long BIGEST=1000000000000000000+1000000000000000000;
const long long BIGER=1000000000000000000;
const int BIG=1000000000;
const long long MOD=1004535809;
const long long LMOD=154590409516822759;
//const long long LMOD=1000000007;
#define Fi first
#define Se second
#define P2 pair
#define Pii pair<int,int>
#define Pll pair<long long,long long>
#define Cb make_pair
#define ll long long
#define Ull unsigned long long
#define Sf scanf
#define Pf printf
#define Pb push_back
#define Psh push
#define Stc stack
#define Vct vector
#define Ret return
#define Re0 return 0
#define Sz size
#define Is insert
#define Que queue
#define Emp empty
#define Fro front
#define Rv reverse
#define Er erase
#define Bg begin
#define Srt sort
#define Pq priority_queue
#define Ins insert
#define Ite iterator
#define Cou count
#define Cot continue
#define Beg begin
ll gcd(ll a,ll b)
{
	//cout<<a<<" "<<b<<endl;
	if(a==0)return b;
	if(b==0)return a;
	if(a==b)return b;
	if(a>b)return gcd(a%b,b);
	return gcd(b%a,a);
}
int main()
{
	ll a,b;
	cin>>a>>b;
	cout<<a*b/gcd(a,b);
	return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,p; cin >> n >> p;
    string s;cin >> s;

    if(p == 2 || p == 5){
        reverse(all(s));
        ll ans = 0;
        rep(i,0,n){
            ll t = s[i] - '0';
            if(t % p == 0){
                ans += n-i;
            }
        }
        cout << ans << "\n";
        return 0;
    }

    vector<ll> v(n), pow(n);

    pow[0] = 1;
    rep(i,1,n){
        pow[i] = pow[i-1] * 10 % p;
    }
    reverse(all(s));
    rep(i,0,n){
        ll t = s[i] - '0';
        v[i] = pow[i] * t % p;
        if(i)v[i] = (v[i] + v[i-1]) % p;
    }
    debug(v);
    map<ll, ll> mp;
    mp[0] = 1;
    ll ans = 0;
    rep(i,0,n){
        if(mp.count(v[i])){
            ans += mp[v[i]];
        }
        mp[v[i]]++;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 6984
n=int(input())
l=list(map(int,input().split()))
d=list(map(int,input().split()))
s=0
for i in range(n):
    if(l[i]>=d[i]):
        s+=d[i]
    else:
        s+=min(l[i]+l[i+1],d[i])
        l[i+1]=max(0,l[i+1]-(d[i]-l[i]))
print(s)


Measured memory_bytes: 97480
N, K = map(int, input().split(" "))

# K = 0

def main():
    if K == 0:
        M = N * (N-1) // 2
        print(M)
        for i in range(1, N+1):
            for j in range(i+1, N+1):
                print("%d %d" % (i, j))
        return
    if N == 2 or K > (N-1) * (N-2) // 2:
        M = -1
        print(M)
        return

    M = N * (N-1) // 2 - K
    print(M)
    count = 0
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            if 1 not in [i, j] and count < K:
                count += 1
            else:
                print(i, j)

main()

Measured memory_bytes: 3608
n = gets.chomp.to_i

ans = 0
3.upto(9) do |i|
  ['7', '5', '3'].repeated_permutation(i) do |a|
    next if a.join('').to_i > n
    if a.include?('7') && a.include?('5') && a.include?('3')
      ans += 1
    end
  end
end
p ans


Measured memory_bytes: 4220
/*input
997764507000

*/

#include <bits/stdc++.h>

using namespace std;

int part(int cnt) {
  int ans = 0;
  for (int i = 1; cnt >= i; cnt -= i, ++i, ++ans) {}
  return ans;
}

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int64_t ans = 0;
  int64_t n; cin >> n;
  for (int i = 2; n / i > i; ++i) {
    if (n % i) continue;
    int cnt = 0;
    while (n % i == 0) n /= i, cnt++;
    ans += part(cnt);
  }
  if (n > 1) ans++;
  cout << ans;

  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <math.h>
#define REP0(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REP1(i,n) for((i)=1;(i)<=(long long)(n);(i)++)
#define ll long long
using namespace std;

ll i,j;
const ll MOD = 1000000000 + 7;

int main(){
    ll a,b,c,d;
    ll ans=0;
   

    cin>>a>>b>>c>>d;
    ans=max(a*c,b*d);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    
    
    
    
   
    
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 3628
data = []

while data = gets

	data = data.split(nil)
	data.map!{|n| n.to_f}

	x = (data[2] * data[4] - data[1] * data[5]) / (data[0] * data[4] - data[1] * data[3])
	y = (data[2] * data[3] - data[0] * data[5]) / (data[1] * data[3] - data[0] * data[4])

	puts printf("%.3f %.3f", x + 0, y + 0)
end

Measured memory_bytes: 8676
#!/usr/bin/env python3


def calc(x1, r, D):
    return r * x1 - D


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    r, d, x = list(map(int, input().split(" ")))
    for _ in range(10):
        x = calc(x, r, d)
        print(x)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
using namespace std;
#define vel vector<long long>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
vel uni(vel &list) {
	if (list.size() == 0) { return list; }
	sort(list.begin(), list.end());
	vel ql(1, list[0]);
	rep(i, list.size() - 1) {
		if (list[i] != list[i + 1]) { ql.push_back(list[i + 1]); }
	}
	list = ql;
	return ql;
}
signed main() {
	int n; cin >> n;
	vel s(n);
	rep(i, n) { cin >> s[i]; }
	int ans = 0;
	for (int a = 1; a < n; a++) {
		if ((n-1)%a == 0) {
			int qans = 0;
			int itr1 = a; int itr2 = n - a-1;
			while (itr1 < itr2) {
				qans += s[itr1] + s[itr2];
				itr1 += a; itr2 -= a;
				mmax(ans, qans);
			}
		}
		else {
			int qans = 0;
			int itr1 = a; int itr2 = n - a-1;
			while (a < itr2) {
				qans += s[itr1] + s[itr2];
				itr1 += a; itr2 -= a;
				mmax(ans, qans);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    ll N, K; cin >> N >> K;
    if (N == 0 || K == 1 || N == K) {
        cout << 0 << endl;
        return 0;
    }

    if (N > K) {
        N -= (N / K) * K;
        cout << min(N, K - N) << endl;
    } else {
        cout << min(N, K - N) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int ans =0 ;
		int[] V = new int[N];
		int[] C = new int[N];
		
		for(int i=0;i<N;i++){
			V[i] = Integer.parseInt(sc.next());
		}
		for(int i=0;i<N;i++){
			C[i] = Integer.parseInt(sc.next());
		}
		
		for(int i=0;i<N;i++){
			if(V[i]-C[i]>0)ans+=(V[i]-C[i]);
		}


		System.out.println(ans);
		
		
		sc.close();
	}
	
}


Measured memory_bytes: 21972
import java.util.*;

class Pos{
	double x,y,z;
}
class Scope{
	double lx,ly,lz,phi;
}

class Main{
	Scanner scan = new Scanner(System.in);
	int star_num;
	int scope_num;
	int ans;
	Pos[] pos;
	Scope[] scope;
	public double keisan(int i,int j,Pos[] pos,Scope[] scope){
		return Math.acos((pos[i].x*scope[j].lx+pos[i].y*scope[j].ly+pos[i].z*scope[j].lz)/
		(Math.sqrt(pos[i].x*pos[i].x+pos[i].y*pos[i].y+pos[i].z*pos[i].z)*(Math.sqrt(scope[j].lx*scope[j].lx+scope[j].ly*scope[j].ly+scope[j].lz*scope[j].lz))));
	}
	public void run(){
		while(true){
			star_num = scan.nextInt();
			if(star_num == 0) break;
	 		pos = new Pos[star_num];
			for(int i=0;i<star_num;i++){
				pos[i] = new Pos();
				pos[i].x = scan.nextDouble();
				pos[i].y = scan.nextDouble();
				pos[i].z = scan.nextDouble();
			}
			scope_num = scan.nextInt();
			scope = new Scope[scope_num];
			for(int i=0;i<scope_num;i++){
				scope[i] = new Scope();
				scope[i].lx = scan.nextDouble();
				scope[i].ly = scan.nextDouble();
				scope[i].lz = scan.nextDouble();
				scope[i].phi = scan.nextDouble();
			}
			ans=0;
			for(int i=0;i<star_num;i++){
				for(int j=0;j<scope_num;j++){
					if(keisan(i,j,pos,scope) < scope[j].phi){
						ans++;
						break;
					}
				}
			}
		System.out.println(ans);
		}
	}

    public static void main(String[] args){
		Main app = new Main();
		app.run();
    }
}

Measured memory_bytes: 71952
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,Y,A,B,C;
  cin >> X>>Y>>A>>B>>C;
  vector<int> vecA(A), vecB(B),vecC(C);
  for(int i=0;i<A;i++) {
    cin>> vecA.at(i);
  }
  for(int i=0;i<B;i++) {
    cin>> vecB.at(i);
  }
  
   for(int i=0;i<C;i++) {
    cin>> vecC.at(i);
  }
  sort(vecB.begin(),vecB.end());
   sort(vecA.begin(),vecA.end());
  reverse(vecB.begin(),vecB.end());
   reverse(vecA.begin(),vecA.end());
  
  vector<int> vecABC(X+Y+C);
  for(int i=0; i<X; i++) {
    vecABC.at(i)=vecA.at(i);
  }
  for(int i=0; i<Y; i++) {
    vecABC.at(X+i)=vecB.at(i);
  }
    for(int i=0; i<C; i++) {
    vecABC.at(X+Y+i)=vecC.at(i);
  }
  sort(vecABC.begin(),vecABC.end());
  reverse(vecABC.begin(),vecABC.end());
  int64_t answer=0;
  for(int i =0;i<X+Y;i++) {
answer+=vecABC.at(i);
  }
 cout << answer << endl;
}
  
  
  
  
  
  
  


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
int main(){
  string x;
  cin>>x;
  if (x=="a"|| x=="b" || x=="c" ||  x=="d"||  x=="e"||  x=="f" || x=="g"||  x=="h"||  x=="i"||  x=="j"||  x=="k"||  x=="l"||  x=="m"||  x=="n"||  x=="o"||  x=="p"||  x=="q"||  x=="r"||  x=="s"||  x=="t"||  x=="u"||  x=="v"|| x=="w"||  x=="x"||  x=="y"||  x=="z"){
    cout<<"a"<<endl;}
  else {cout<<"A"<<endl;}
}


Measured memory_bytes: 3628
N=int(input())
A=list(sorted(list(map(int,input().split()))))

j=0
while True:
	if len(A)==1:
		break

	i=0
	while True:
		if i==len(A):
			break
		if A[i]<1:
			A.pop(i)
			i-=1
		i+=1

	A.sort()

	for i in range(1,len(A)):
		A[i]=A[i]%A[0]

	j+=1
print(A[0])

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

struct edge{
	lli to,cost;
};

vector<vector<edge>> v;
bool vis[100100];
lli dist[100100];

signed main(){

	lli n,m;
	cin>>n>>m;
	v.resize(n);

	map<lli,lli> d;

	lli sx;

	REP(i,0,m){
		lli x,y,dd;
		cin>>x>>y>>dd;
		x--,y--;
		if(i==0)sx=x;
		v[x].push_back({y,dd});
		v[y].push_back({x,-dd});
	}

	REP(i,0,n){
			if(vis[i]==false){
				queue<lli> q;
				q.push(i);
				dist[i]=0;
				vis[i]=true;
				while(q.size()){
					lli top = q.front();
					q.pop();

					for(auto &e:v[top]){
						if(vis[e.to]){
							if(dist[e.to] != dist[top]+e.cost){
								cout<<"No"<<endl;
								return 0;
							}
							continue;
						}
						vis[e.to]=true;
						dist[e.to] = dist[top]+e.cost;
						q.push(e.to);
					}
				}
			}
	}
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 14080
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    lint A, B, C;
    cin >> A >> B >> C;
    cout << (A <= C and C <= B ? "Yes" : "No") << "\n";
}

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

#define ll long long int
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define all(A) A.begin(), A.end()
#define sz(A) (int)A.size()
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tii;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
const int inf = 1e9;
//const ll inf = 1e18;
const int N = 2e5;

void solve () {
	string s;
	cin >> s;
	int cnt = 0, mx = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'R') cnt++;
		else cnt = 0;
		mx = max(mx, cnt);
	}
	mx = max(mx, cnt);
	cout << mx << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
  #endif
	int t = 1;
	while (t--) {
		solve();
	}
 	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	bool xp = 0, xc = 0, xm = 0, yp = 0, yc = 0, ym = 0;
	int XPmn = 1e9, XPmx = -1e9, XCmn = 1e9, XCmx = -1e9;
	int XMmn = 1e9, XMmx = -1e9, YPmn = 1e9, YPmx = -1e9;
	int YCmn = 1e9, YCmx = -1e9, YMmn = 1e9, YMmx = -1e9;
	for(int i = 0; i < N; i++){
		int x, y; char d; 
		cin >> x >> y >> d; 
		if(d == 'R'){
			xp = 1; yc = 1; 
			XPmn = min(XPmn, x*2); XPmx = max(XPmx, x*2); 
			YCmn = min(YCmn, y*2); YCmx = max(YCmx, y*2); 
		}
		if(d == 'L'){
			xm = 1; yc = 1; 
			XMmn = min(XMmn, x*2); XMmx = max(XMmx, x*2); 
			YCmn = min(YCmn, y*2); YCmx = max(YCmx, y*2); 
		}
		if(d == 'U'){
			yp = 1; xc = 1; 
			YPmn = min(YPmn, y*2); YPmx = max(YPmx, y*2); 
			XCmn = min(XCmn, x*2); XCmx = max(XCmx, x*2);  
		}
		if(d == 'D'){
			ym = 1; xc = 1; 
			YMmn = min(YMmn, y*2); YMmx = max(YMmx, y*2); 
			XCmn = min(XCmn, x*2); XCmx = max(XCmx, x*2);  
		}
	}
	vector<int> when = {}; 
	when.push_back(0); 
	if(xp & xc) {
		when.push_back(XCmx - XPmx); 
		when.push_back(XCmn - XPmn); 
	}
	if(xm & xc) {
		when.push_back(XMmx - XCmx); 
		when.push_back(XMmn - XCmn); 
	}
	if(xp & xm) {
		when.push_back((XMmx - XPmx) / 2); 
		when.push_back((XMmn - XPmn) / 2); 
	}
	if(yp & yc) {
		when.push_back(YCmx - YPmx); 
		when.push_back(YCmn - YPmn); 
	}
	if(ym & yc) {
		when.push_back(YMmx - YCmx); 
		when.push_back(YMmn - YCmn); 
	}
	if(yp & ym) {
		when.push_back((YMmx - YPmx) / 2); 
		when.push_back((YMmn - YPmn) / 2); 
	}
	long long int ans = 8e18; 
	for(int i = 0; i < when.size(); i++){
		if(when[i] < 0) continue; 
 		long long int tmp; 
		int R = -1e9, L = 1e9, U = -1e9, D = 1e9; 
		if(xp) {
			R = max(R, XPmx + when[i]); 
			L = min(L, XPmn + when[i]); 
		}
		if(xm) {
			R = max(R, XMmx - when[i]); 
			L = min(L, XMmn - when[i]); 
		}
		if(xc) {
			R = max(R, XCmx); 
			L = min(L, XCmn); 
		}
		if(yp) {
			U = max(U, YPmx + when[i]); 
			D = min(D, YPmn + when[i]); 
		}
		if(ym) {
			U = max(U, YMmx - when[i]); 
			D = min(D, YMmn - when[i]); 
		}
		if(yc) {
			U = max(U, YCmx); 
			D = min(D, YCmn); 
		}
		tmp = (long long) (R - L) * (U - D); 
		ans = min(tmp, ans); 
	}
	cout.precision(20); 
	long double final = (long double) ans * 0.25; 
	cout << final << endl; 
}

Measured memory_bytes: 256