akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define vi          vector<int>
#define vll         vector<long long>
#define vpi         vector<pair<int>>
#define vpll        vector<pair<long long>>
#define vvi         vector<vector<int>>
#define vvll        vector<vector<long long>>
#define vvpi        vector<vector<pair<int,int>>>
#define vvpll       vector<vector<pair<long long>>>
#define int long long
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
} 

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}
int n,k;
bool check(vector<int> &a){
    for(int i = 0; i<n; i++)if(a[i]<n)return false;
    return true;
}
void solve(){
    cin>>n>>k;
    vector<int> a(n);
    for(int i = 0; i<n; i++)cin>>a[i];
    vector<int> temp;
    while(!check(a)&&k>0){
        temp.clear();
        temp.assign(n,0);
        for(int i = 0; i<n; i++){
            int l = max(0*1LL,i-a[i]);
            int r = min(n,i+a[i]);
            temp[l]+=1;
            if(r+1<n)temp[r+1]-=1;
        }
        for(int i = 1; i<n; i++){
            temp[i]+=temp[i-1];
        }
        a = temp;
        k-=1;
    }
    for(int x:a)cout<<x<<' ';
}

signed main(){
    fastio();
    int t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
}

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

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

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

    long long mc = min(a, c);
    a -= mc;
    c -= mc;

    long long mb = min(b, c) * 2;

    b -= mb / 2;
    c -= mb / 2;

    long long ans = mc + mb + b + (c >= 1);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# ?????????????????¨????????????
class Dice(object):
	def __init__(self, L=[1, 2, 3, 4, 5, 6]):
		# ????????¶???
		self.dice = (L[1], L[4]), (L[2], L[3]), (L[0], L[5]) # x, y, z
		self.ax = [[0, False], [1, False], [2, False]]
		self.axmap = [0, 1, 2]
		self.mm = {"N": (0, 2), "S": (2, 0), "E": (1, 2), "W": (2, 1), "R": (0, 1), "L": (1, 0)}

	def rotate(self, dir):
		def rot(k, r):
			t = self.axmap[r]
			self.axmap[k], self.axmap[r] = t, self.axmap[k]
			self.ax[t][1] = not self.ax[t][1]

		rot(*self.mm[dir])

	def front(self): return self.value(0, True)
	def rear(self): return self.value(0, False)
	def right(self): return self.value(1, True)
	def left(self): return self.value(1, False)
	def top(self): return self.value(2, True)
	def bottom(self): return self.value(2, False)
	def value(self, ax, d):
		a = self.ax[self.axmap[ax]]
		return self.dice[a[0]][a[1] if d else not a[1]]

if __name__=="__main__":
	dice1 = Dice(input().split())
	dice2 = Dice(input().split())
	def tf(p, f, d):
		for _ in range(4):
			if p==f(): break
			dice1.rotate(d)
	p = dice2.top()
	f = dice1.top
	tf(p, f, "N")
	if p!=f(): tf(p, f, "E")
	
	p = dice2.front()
	f = dice1.front
	tf(p, f, "R")

	if dice1.left()==dice2.left():
		print("Yes")
	else:
		print("No")

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int r, g, b;
  cin >> r >> g >> b;
  int a = g * 10 + b;
  if(a % 4 == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;
    
    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];
    
    int maxv = -2000000000;
    int minv = R[0];
    
    for (int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    
    cout << maxv << endl;
    
    return 0;
}


Measured memory_bytes: 3876
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vector<pair<int, int>> a(n);
	for (int i = 0; i < n; i++)
		cin >> a[i].first >> a[i].second;
	for (int i = 0; i + 2 < n; i++) {
		if (a[i].first == a[i].second and a[i + 1].first == a[i + 1].second and a[i + 2].first == a[i + 2].second) {
			cout << "Yes" << "\n";
			return 0;
		}
	}
	cout << "No" << "\n";
	return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll c[100000];
int main(void){
  ll n,cnt=0;
  scanf("%lld",&n);
  if(!n)PRN(0);
  while(n){
    if(n!=n/2*2){
      c[cnt++]=1;
      n--;
    }else{
      c[cnt++]=0;
    }
    n/=-2;
  }
  FOR(cnt)printf("%lld",c[cnt-1-i]);
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<queue>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<functional>
#include<limits.h>
#include<numeric>
using namespace std;
int main()
{
	long long int n,n1;
	cin>>n;
	n1=n;
	long long int count=0;
	vector<pair<long long,long long>> v;
	vector<pair<long long ,long long>> u; 
	vector<pair<long long ,long long>> f; 
	for(int i=0;i<n;i++)
	{
		long long a,b;
		cin>>a>>b;
		v.push_back(make_pair(a,b));
		u.push_back(make_pair(b,i));
	}
	sort(u.begin(),u.end());
	for(int i=0;i<u.size();i++)
	{
		f.push_back(v[u[i].second]);
		//cout<<v[u[i].second].first<<" "<<v[u[i].second].second<<endl;
	}
	//cout<<endl;
	//cout<<endl;
	//cout<<endl;
	//cout<<endl;
	//cout<<endl;
	//cout<<endl;
	long long curr_time=0;
	for(long long int i=0;i<f.size();i++)
	{

		if((f[i].first+curr_time) <= f[i].second)
		{
			//cout<<f[i].first<<" "<<f[i].second<<endl;
			count++;
			
		}
		//cout<<f[i].first<<" "<<f[i].second<<endl;
		curr_time+=f[i].first;
	}
	//cout<<count<<endl;
	if(count==n)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}

Measured memory_bytes: 15452
#include <iostream>
    #include <vector>
    #include <string>
    #include <numeric>
    #include <tuple>
    #include <algorithm>
    #include <array>
    using namespace std;
    using ll = long long;
    #define rep(i,n) for(decltype(n) i=0; i<n; ++i)
    inline constexpr ll Inf = (1ULL << 62) -1;
     
    template <class T>
    void updatemax(T& a, T b) { if (b > a) a = b; }
     
    int main() {
      	ll x[5];
        ll ans=0;
        rep(i,5) cin >> x[i];
      	ans = 1 + find(begin(x), end(x), 0) - begin(x);
        cout << ans << endl;
        return 0;
    }

Measured memory_bytes: 3128
n, m = map(int, raw_input().strip().split())
a = map(int, raw_input().strip().split())

sticks = [6,2,5,5,4,5,6,3,7,6]

dp = [[0 for i in xrange(10)] for j in xrange(n + 1)]

for i in xrange(2, n + 1):
    nl = [0 for k in xrange(10)]
    for dig in a:
        if i - sticks[dig] < 0: continue
        if i - sticks[dig] > 0 and dp[i - sticks[dig]][0] == 0: continue
        cur = [dp[i - sticks[dig]][j] for j in xrange(10)]
        
        cur[10 - dig] += 1
        cur[0] += 1
        
        nl = max(nl, cur)
    
    dp[i] = nl
    #print i, dp[i]

#print dp[n]

out = []
for i in xrange(1, 10):
    if dp[n][i] == 0: continue
    for j in xrange(dp[n][i]): out.append(str(10 - i))

print ''.join(out)

Measured memory_bytes: 35612
def main():
    N, *A = map(int, open(0).read().split())
 
    B = sorted(A)
    l, r = 0, N
    m, c = N // 2, N * (N + 1) // 2
 
    def check(x):
        b, r, y = N, 0, 0
        D = [0] * (2 * N + 1)
        for a in A:
            D[b] += 1
            if a < x:
                r += D[b]
                b += 1
            else:
                b -= 1
                r -= D[b]
            y += r
        return y
 
    while True:
        if check(B[m]) <= c // 2:
            if m == N - 1 or check(B[m + 1]) > c // 2:
                break
            else:
                l, m = m, (m + r) // 2
        else:
            m, r = (m + l) // 2, m + 1
 
    print(B[m])
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 14476
#include <bits/stdc++.h>
using namespace std;
int main(){
int H,W;
  cin>>H>>W;
  vector<string> ss(H);
  for(int i=0;i<H;i++){
      cin>>ss.at(i);
    }  
  vector<vector<char>> S(H+2,vector<char>(W+2,'.'));
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
      if(1<=i&&i<=H&&1<=j&&j<=W){
      S.at(i).at(j)=ss.at(i-1).at(j-1);
    }
    }
  }
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      int count=0;
      if(S.at(i).at(j)!='#'){
        if(S.at(i-1).at(j-1)=='#') count++;
        if(S.at(i-1).at(j)=='#') count++;
        if(S.at(i-1).at(j+1)=='#') count++;
        if(S.at(i).at(j-1)=='#') count++;
        if(S.at(i).at(j+1)=='#') count++;
        if(S.at(i+1).at(j-1)=='#') count++;
        if(S.at(i+1).at(j)=='#') count++;
        if(S.at(i+1).at(j+1)=='#') count++;
        S.at(i).at(j)=count+'0';
      }
    }
  }
  for(int i=1;i<=H;i++){
    for(int j=1;j<=W;j++){
      cout<<S.at(i).at(j);
    }
    cout<<endl;
  }
}

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

dic = {}
for i in range(N):
    S, P = [i for i in input().split()]
    if S in dic:
        dic[S].append((int(P), i + 1))
    else:
        dic[S] = [(int(P), i + 1)]

for s in sorted(dic.keys()):
    for l in reversed(sorted(dic[s])):
        print(l[1])

Measured memory_bytes: 3060
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int ans[101010];
vector<int>pat[101010];
bool flag[101010];
int d[101010];
int pt = 0;
typedef long long ll;
void dfs(int node)
{
	if (flag[node])return;
	flag[node] = true;
	for (int i = 0; i < pat[node].size(); i++)dfs(pat[node][i]);
	ans[node] = d[pt++];
}
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num - 1; i++)
	{
		int za, zb;
		scanf("%d%d", &za, &zb);
		za--, zb--;
		pat[za].push_back(zb), pat[zb].push_back(za);
	}
	for (int i = 0; i < num; i++)scanf("%d", &d[i]);
	sort(d, d + num);
	ll s = 0;
	for (int i = 0; i < num - 1; i++)s += d[i];
	dfs(0);
	printf("%d\n", s);
	for (int i = 0; i < num; i++)printf("%d ", ans[i]); printf("\n");
}

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

// グラフの各連結成分について |F|:グラフがR^2を何個の領域に分割するか, |V|:頂点数, |E|:辺数 とすると
// |V|-|E|+|F|= 2 が成り立つ。
// この問題では木を考えているので|F|=1 が成り立つ。
// よってグラフ全体では (連結成分数)= |V|-|E| が成り立つ
int main(){
  using edge= pair<int64_t, int64_t>;
  int64_t N;
  cin >> N;
  const int64_t M= N-1;

  vector<edge> edges(M);
  int64_t v1, v2;
  for(int64_t j=0; j<M; j++){
    cin >> v1 >> v2;
    if(v1 > v2){ swap(v1, v2); }

    edges.at(j)= make_pair(v1, v2);
  }

  int64_t sumV= 0;
  for(int64_t v=1; v<=N; v++){
    sumV+= v*(N+1- v);
  }

  int64_t sumE= 0;
  for(auto [v1, v2]:edges){
    sumE+= v1*(N+1- v2);
  }

  int64_t ans= sumV- sumE;
  
  cout << ans << endl;
}

Measured memory_bytes: 6428
x = input()
x = int(x)

Card = [[1 for i in range(13)] for j in range(4)]
Type = ['S','H','C','D']

for i in range(x):
    t = input().split()
    for j in range(4):
        if t[0] == Type[j]:
            break
    Card[j][int(t[1])-1]=0

for j in range(4):
    for i in range(13):
        if Card[j][i]==1:
            print(Type[j],i+1)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
 
int N;
int x[10], y[10];
 
double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}
 
void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];
    double sum = 0.0;
    vector<int> v(N);
    for(int i = 0; i < N; i++) v[i] = i + 1;
    do {
        for(int i = 0; i < N - 1; i++) sum += dist(v[i], v[i+1]);
    } while(next_permutation(v.begin(), v.end()));
    int Factorial = 1;
    for(int i = 2; i <= N; i++) Factorial *= i;
    cout << fixed << setprecision(10) << sum / Factorial << endl;
    return;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000;
int main(){
  int N;
  cin >> N;
  int M = 2 * N * N - 2 * N;
  vector<vector<int>> E(N * N);
  for (int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  int s = -1, t = -1;
  for (int i = 0; i < N * N; i++){
    if (E[i].size() == 2){
      s = i;
      break;
    }
  }
  vector<int> d1(N * N, INF);
  d1[s] = 0;
  queue<int> Q1;
  Q1.push(s);
  while (!Q1.empty()){
    int v = Q1.front();
    Q1.pop();
    for (int w : E[v]){
      if (d1[w] == INF){
        d1[w] = d1[v] + 1;
        Q1.push(w);
        if (E[w].size() == 2 && t == -1){
          t = w;
        }
      }
    }
  }
  vector<int> d2(N * N, INF);
  d2[t] = 0;
  queue<int> Q2;
  Q2.push(t);
  while (!Q2.empty()){
    int v = Q2.front();
    Q2.pop();
    for (int w : E[v]){
      if (d2[w] == INF){
        d2[w] = d2[v] + 1;
        Q2.push(w);
      }
    }
  }
  vector<vector<int>> ans(N, vector<int>(N));
  for (int i = 0; i < N * N; i++){
    ans[(d1[i] + d2[i] - N + 1) / 2][(d1[i] - d2[i] + N - 1) / 2] = i + 1;
  }
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      cout << ans[i][j];
      if (j < N - 1){
        cout << ' ';
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 3692
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

ll m(ll a, ll b){
	if (a > b) return a;
	return b;
}

int main(){
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll x = m(a * c, b * d);
	ll y = m(a * d, b * c);
	ll ans = m(x, y);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

long gcd(long x, long y)
{
        if (y == 0)
                return x;
        else
                return gcd(y, x % y);
}

long lcm(long x, long y)
{
        return x / gcd(x, y) * y;
}

int main(void)
{
        long x, y;
        for (;;) {
                if (scanf("%ld%ld", &x, &y) == EOF)
                        return 0;
                printf("%ld %ld\n", gcd(x, y), lcm(x, y));
        }
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
#include<stdio.h>   
#include<stdlib.h>


int main(){
    int n,k,tmp;
    scanf("%d%d",&n,&k);
    int num[n];
    for(int i = 0;i < n;i++) {
        num[i] = 0;
        scanf("%d",&num[i]);
    }
    for ( int i=0; i<n; ++i) {
        for (int j=i+1; j<n; ++j) {
            if (num[i] > num[j]) {
                tmp =  num[i];
                num[i] = num[j];
                num[j] = tmp;
            }
        }
    }

    int a = 0;
    for(int i = 0;i < k;i++) a += num[i];
    printf("%d\n",a);
}

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

constexpr long long mod{1000000007};

long long fact[100010], inv[100010], finv[100010];

void combiIni();
long long permu(long long, long long);

int main()
{
	combiIni();
	int N, X;
	scanf("%d%d", &N, &X);
	std::vector<int> S(N);
	for (auto& e: S) scanf("%d", &e);
	std::sort(S.begin(), S.end());

	std::vector<int> S_num(X + 1);
	for (int i{}; i < N; i++)
	{
		if (S[i] > X) break;
		S_num[S[i]]++;
	}
	for (int i{}; i < X; i++) S_num[i + 1] += S_num[i];

	std::vector<long long> dp(X + 1);
	dp[X] = 1;
	for (int i{X}; i >= S.front(); i--)
	{
		if (dp[i] == 0) continue;
		for (int j{}; j < S_num[i]; j++)
		{
			int next{i % S[j]};
			dp[next] = (dp[next] + dp[i] * permu(S_num[i] - 1, S_num[i] - S_num[next] - 1) % mod) % mod;
		}
	}
	long long sum{};
	for (int i{}; i <= X; i++)
	{
		if (i >= S.front()) break;
		sum = (sum + dp[i] * i % mod) % mod;
	}
	sum = sum * permu(N, N - S_num.back()) % mod;
	printf("%lld\n", sum);

	return 0;
}

void combiIni()
{
	fact[0] = fact[1] = inv[0] = inv[1] = finv[0] = finv[1] = 1;
	for (int i{2}; i < 100010; i++)
	{
		fact[i] = fact[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}

long long permu(long long n, long long r)
{
	if (n < 0 || n - r < 0 || r < 0) return 0;
	return (long long)fact[n] * finv[n - r] % mod;
}

Measured memory_bytes: 3840
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int p[51];
    rep(i, N) cin >> p[i];
    REP(i, 0, N - 1) {
        REP(j, i, N - 1) {
            swap(p[i], p[j]);
            bool ok = true;
            rep(k, N - 1) {
                if(p[k] > p[k + 1]) ok = false;
            }
            if(ok) {
                cout << "YES" << endl;
                return 0;
            }
            swap(p[i], p[j]);
        }
    }
    cout << "NO" << endl;

    return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(x) ll t; cin >> t; x.push_back(t);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<string> vvs;

const static ll MOD = 1e9 + 7;

int main() {
    ll a, b;
    cin >> a >> b;

    if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
        MSG(a * b)
    } else {
        MSG(-1)
    }
}


Measured memory_bytes: 256
n = int(input())
q = ['a']
for i in range(n-1):
   nq = []
   for s in q:
      stop = ord(max(s)) + 2
      for i in range(ord('a'), stop):
         nq.append(s + chr(i))
   q = nq

for s in q:
   print(s)


Measured memory_bytes: 12988
def main():
    N = int(input())
    A = map(int, input().split())
    x = [0] * (N + 1)
    
    for a in A:
        x[a] += 1
    x = x[1:]
    
    for i in x:
        print(i)

if __name__ == '__main__':
    main()

Measured memory_bytes: 24516
import scala.io.StdIn

object Main extends App {

  private val s = StdIn.readLine()
  private val p = StdIn.readLine()
  private val stsize = s.size 
  var i = 0
  
  def search(i: Int): Boolean = {
    if(i > stsize) {
      false
    } else {
      if((s.slice(i, stsize + i) + s.slice(0, i)).indexOf(p) >= 0){
        true
      } else {
        search(i+1)
      }
    }
  }
  
  println(if(search(0)) "Yes" else "No")
  
}


Measured memory_bytes: 43840
def main():
    n = int(input())
    ddic = {}
    tlis = []
    dlis = list(map(int, input().split()))
    m = int(input())
    tlis = list(map(int, input().split()))
    for d in dlis:
        if d in ddic:
            ddic[d] += 1
        else:
            ddic[d] = 0
    for t in tlis:
        if t in ddic and ddic[t] >= 0:
            #print(t,tlis, dlis)
            ddic[t] -= 1
        else:
            #print(t,tlis, dlis)
            print("NO")
            exit()
    print("YES")


if __name__ == "__main__":
    main()

Measured memory_bytes: 127700
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

template<typename Monoid>
struct SegmentTree {
  using F=function<Monoid(Monoid, Monoid)>;

  int sz;
  vector<Monoid> seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }

  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};

int main() {
  int N, Q;
  scanf("%d %d", &N, &Q);
  //<型> seg(サイズ,二項演算,単位元) 1-index
  SegmentTree<int> seg(N,[](int a,int b){return max(a, b);},-1);
  
  rep(i,N){
    int x;
    scanf("%d", &x);
    seg.set(i,x);
  }
  seg.build();
  
  rep(i,Q){
    int T,X,Y;
    scanf("%d %d %d",&T,&X,&Y);
    if(T==1) seg.update(X-1,Y);
    else if(T==2) printf("%d\n", seg.query(X-1,Y));
    else{
      int a=seg.find_first(X-1,[&](int b){return b>=Y;});
      if(a==-1) a=N;
      printf("%d\n",a+1);
    }
  }
  return 0;
}

Measured memory_bytes: 5364
from heapq import heapify, heappop, heappush, heappushpop


class PriorityQueue:
    def __init__(self, heap):
        '''
        heap ... list
        '''
        self.heap = heap
        heapify(self.heap)

    def push(self, item):
        heappush(self.heap, item)

    def pop(self):
        return heappop(self.heap)

    def pushpop(self, item):
        return heappushpop(self.heap, item)

    def __call__(self):
        return self.heap

    def __len__(self):
        return len(self.heap)


x, y, z, k = map(int, input().split())
a_ls = list(map(int, input().split()))
b_ls = list(map(int, input().split()))
c_ls = list(map(int, input().split()))

a_ls.sort()
a_ls.reverse()
b_ls.sort()
b_ls.reverse()
c_ls.sort()
c_ls.reverse()

heap = []

q = PriorityQueue(heap)
q.push((-(a_ls[0] + b_ls[0] + c_ls[0]), 0, 0, 0))
considered = set()
for i in range(k):
    val, i, j, k = q.pop()
    print(-val)
    for di, dj, dk in zip([1, 0, 0], [0, 1, 0], [0, 0, 1]):
        ni = i + di
        nj = j + dj
        nk = k + dk
        if ni >= x or nj >= y or nk >= z:
            continue
        if (ni, nj, nk) not in considered:
            considered.add((ni, nj, nk))
            q.push((-(a_ls[ni] + b_ls[nj] + c_ls[nk]), ni, nj, nk))


Measured memory_bytes: 5096
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, read().split())

def f(a, b):
    if a <= 0 <= b:
        return 0
    if a > 0:
        return 1
    b = min(b, -1)
    n = b - a + 1
    return (-1) ** n

words = ['Zero', 'Positive', 'Negative']
print(words[f(a, b)])

Measured memory_bytes: 9148
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<n; ++i)
typedef long long ll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    double h,w,n; cin>>h>>w>>n;
    cout<< ceil(n/max(h,w))<<endl; return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fr first
#define sc second
const int inf=INT_MAX;
const int nmax=1e5+5;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
int n,i,v,j,v1;
string s,ans1,ans0;
int main() 
{
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>s;
    for(i=0;i<n;i++)
	{
		if(s[i]=='(')
		{
			v1=v;
			for(j=i+1;j<n;j++)
			{
			  if(s[j]==')' && !v1)
			  {
				v++;
				break;
			  }
			  else if(s[j]==')')v1--;
			}
			if(j==n)ans1+=')';
		}
		else
		{
			v--;
			if(v<0)ans0+='(',v=0;
		}
	}
	cout<<ans0+s+ans1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
ll n, m, x;
vector<pair<ll, ll> > adj[2010];
pair<ll, pair<ll, ll> > edges[2010];
struct UF
{
	int rep[2010];
	void init()
	{
		for (int i = 0; i < 2010; i++) rep[i] = i;
	}
	int findrep(int a)
	{
		if (rep[a] == a) return a;
		return rep[a] = findrep(rep[a]);
	}
	void merge(int a, int b)
	{
		rep[findrep(a)] = findrep(b);
	}
	bool connected(int a, int b)
	{
		return findrep(a) == findrep(b);
	}
};
UF uf;
ll power2[100010];
ll ans;
ll cando[100010];
ll isok[100010];
ll SZ[100010];
void poss(int e)
{
	uf.init();
	ll sz = 0;

	uf.merge(edges[e].second.first, edges[e].second.second);
	sz += edges[e].first;
	ll notused = 0;
	for (int i = 0; i < m; i++)
	{
		int a = edges[i].second.first;
		int b = edges[i].second.second;
		if (uf.connected(a, b)) 
		{
			if (cando[i] && i < e) { notused++; }
			continue; 
		}
		uf.merge(a, b);
		sz += edges[i].first;
	}
	SZ[e] = sz;
	if (sz > x) cando[e] = 1;
}
int main()
{
	scanf("%lld%lld%lld", &n, &m, &x);
	for (int i = 0; i < m; i++)
	{
		scanf("%lld%lld%lld", &edges[i].second.first, &edges[i].second.second, &edges[i].first);
	}
	sort(edges, edges+m);
	power2[0] = 1;
	for (ll i = 1; i <= 2010; i++)
	{
		power2[i] = power2[i-1]*(ll)2;
		power2[i] %= mod;
	}
	for (int i = 1; i < m; i++)
	{
		poss(i);
	}
	for (int i = 1; i < m; i++)
	{
		if (SZ[i] != x) continue;
		ll am = 0;
		for (int j = 0; j < i; j++)
		{
			if (cando[j]) am++;
		}
		for (int j = i+1; j < m; j++)
		{
			if (SZ[j] >= x) am++;
		}
		am = power2[am];
		ans += am;
		ans %= mod;
	}
	ans *= 2;
	ans %= mod;
	printf("%lld\n", ans);
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
using namespace std;
int main() {
    int n, m, a, b, c; cin >> n >> m >> a >> b >> c;
    vector<vector<int> > g(n);
    repeat (i,m) {
        int u, v; cin >> u >> v;
        -- u; -- v;
        g[u].push_back(v);
    }
    vector<vector<bool> > ag, bg, cg; {
        vector<vector<bool> > x(n, vector<bool>(n)); // adjacency matrix
        repeat (i,n) {
            for (int j : g[i]) {
                x[i][j] = true;
            }
        }
        vector<vector<bool> > y = x;
        repeat (t, max(a,max(b,c))) {
            if (a == t+1) ag = y;
            if (b == t+1) bg = y;
            if (c == t+1) cg = y;
            vector<vector<bool> > z(n, vector<bool>(n));
            repeat (i,n) {
                repeat (j,n) {
                    repeat (k,n) {
                        z[i][j] = z[i][j] or (y[i][k] and x[k][j]);
                    }
                }
            }
            y = z;
        }
    }
    set<int> goals;
    goals.insert(n-1);
    for (int turn = 1; ; ++ turn) {
        vector<int> new_goals;
        repeat (i,n) if (not goals.count(i)) {
            bool ok_a = false; repeat (j,n) if (ag[i][j] and goals.count(j)) ok_a = true;
            bool ok_b = false; repeat (j,n) if (bg[i][j] and goals.count(j)) ok_b = true;
            bool ok_c = false; repeat (j,n) if (cg[i][j] and goals.count(j)) ok_c = true;
            if (ok_a and ok_b and ok_c) {
                new_goals.push_back(i);
            }
        }
        if (new_goals.empty()) {
            cout << "IMPOSSIBLE" << endl;
            break;
        }
        goals.insert(new_goals.begin(), new_goals.end());
        if (goals.count(0)) {
            cout << turn << endl;
            break;
        }
    }
    return 0;
}

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

int main () {
  int n;
  cin >> n;
  double x;
  string u;
  double ans=0;
  
  for(int i=0;i<n;i++){
    cin >> x >> u;
    if(u=="BTC"){
      ans+=380000*x;
    }
    else{
      ans+=x;
    }
  }
  cout << ans << endl;
}
      

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ull << (b))

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

class UnionFind {
public:
  vector<int> par;
  vector<int> cnt;
  UnionFind(int n) {
    par = vector<int>(n + 1);
    cnt = vector<int>(n + 1, 1);
    for (int i = 1; i <= n; i++) {
      par[i] = i;
    }
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) {
      return;
    }
    par[x] = y;
    cnt[y] += cnt[x];
    cnt[x] = cnt[y];
  }
  int size(int x) {
    return cnt[root(x)];
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  i64 n, m;
  cin >> n >> m;
  vector<pair<int, int>> ab;
  rep(i, m) {
    int a, b; 
    cin >> a >> b;
    ab.emplace_back(a, b);
  }
  reverse(all(ab));
  i64 ans = n * (n - 1) / 2;
  vi64 answers;
  answers.push_back(ans);
  auto uf = UnionFind(n);
  rep(i, m) {
    int a = ab[i].first, b = ab[i].second;
    if (uf.same(a, b)) {
      answers.push_back(ans);
    } else {
      ans -= (i64) uf.size(a) * uf.size(b);
      answers.push_back(ans);
      uf.unite(a, b);
    }
  }
  reverse(all(answers));
  reps(i, m) {
    cout << answers[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    int n, x, y;
    cin >> n >> x >> y;
    int a[n + 1], b[n + 1], c[n + 1];
    ll dp[100][501][501];
    ll INF = (ll)1e9;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    for (int i = 0; i <= 50; i++)
    {
        for (int j = 0; j <= 500; j++)
        {
            for (int k = 0; k <= 500; k++)
            {
                dp[i][j][k] = INF;
            }
        }
    }
    dp[0][0][0] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 500; j++)
        {
            for (int k = 0; k < 500; k++)
            {
                if (dp[i][j][k] == INF)
                {
                    continue;
                }
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
            }
        }
    }
    ll ans = 10000000;
    for (int j = 1; j < 500; j++)
    {
        for (int k = 1; k < 500; k++)
        {
            if (j * y == k * x)
            {
                ans = min(ans, dp[n][j][k]);
            }
        }
    }
    if (ans == 10000000)
    {
        cout << -1;
    }
    else
    {
        cout << ans;
    }
}


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

int main(){
  int N,Y;
  cin >> N >> Y;
  bool a=1;
  for(int i=0; i<=N; i++){
    for(int j=0; j<=N-i; j++){
      int k=N-i-j;
      if(a&&i+j*5+k*10==Y/1000){
        cout << k << ' ' << j << ' ' << i << endl;
        a=0;
      }
    }
  }
  if(a){
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>

int col, len, d;

int main() {
	scanf("%d%d%d", &col, &len, &d);
	double x = 1./col, res;
	if (len==1) res = 0;
	else {
		int cnt;
		if (d==0) cnt = col;
		else cnt = col*2-d*2;
		double per = 1.*cnt / col;
		res = x * per * (len-1);
	}
	printf("%.10lf\n", res);
	
	return 0;
}

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

int main()
{
  char* s = new char[100001];
  scanf("%s", s);
  int k = 0;
  scanf("%u", &k);
  unsigned len = strlen(s);
  for (unsigned i = 0; i < len; ++i)
  {
    if (len - 1 == i)
    {
      s[i] = (s[i] - 'a' + k) % 26 + 'a';
    }
    else
    {
      int need = ('a' != s[i] ? 'z' - s[i] + 1 : 0);
      if (k >= need)
      {
        s[i] = 'a';
        k -= need;
        if (0 == k)
          break;
      }
    }
  }
  printf("%s", s);
  delete[] s;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;


int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    
    ll ans = 0;
    zep(i, 0, n)ans += (i + 1) * (n - i);

    zep(i, 0, n - 1){
    	ll u, v; cin >> u >> v;
    	if(u > v){ll tmp = u; u = v; v = tmp;}

        ans -= u * (n - v + 1);
    }

    print(ans)
    
    return 0;
}

Measured memory_bytes: 3568
// floyd2.cpp : アプリケーションのエントリ ポイントを定義します。
//

// floyd.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>
using namespace std;



int main()
{
    int N,a[100000],k =0,judge = -1,b[100000];
    
    cin >> N;
    for (int i = 0; i < N;i++) {
        cin >> a[i];
    }
    

    while (N > k) {
        if (k == 0) {
            b[k] = a[0];
        }
        else {
            b[k] = a[b[k-1] -1];
        }
        
        if (b[k] == 2)
        {
            k++;
            judge = k;
            break;
        }
        k++;
        
    }
 
    cout << judge;

    cout << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int a[100003][3],dp[100003][3]={};
int main() {
   int n,k;
  
   cin>>n;
   for(int i=0;i<n;i++)
   for(int j=0;j<3;j++)
   cin>>a[i][j];

   for(int i=0;i<n;i++)
   {
       for(int j=0;j<=2;j++)
       {
           dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
       }
   }

   cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});

}


Measured memory_bytes: 2560
s=list(input())
f=1
for i in range(len(s)):
    if i%2==0:
        if s[i]=="R" or s[i]=="U" or s[i]=="D":
            continue
        else:
            f=0
    else:
        if s[i]=="L" or s[i]=="U" or s[i]=="D":
            continue
        else:
            f=0
if f:
    print("Yes")
else:
    print("No")


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

#define rep(i,n) for(ll i=0;i<n;i++)
#define repm(i,m,n) for(ll i=m;i<n;i++)
#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define YesNo(a) (a)?cout<<"Yes"<<endl:cout<<"No"<<endl
#define YESNO(a) (a)?cout<<"YES"<<endl:cout<<"NO"<<endl
#define INF (2e9)
#define PI (acos(-1))
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007

typedef long long ll;

int main(){
  int a,b,c; cin >> a >> b >> c;
  YesNo((a==b&&b!=c)||(b==c&&c!=a)||(a==c&&a!=b));
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>

using namespace std;

int main(){
   int N,T;
   cin >> N >> T;
   int A[N];
   int cnt = 0;
   int m = INT_MAX;
   int dif = 0;
   for( int i = 0 ; i <N ; i++ ){
      cin >> A[i];
      m=min(m,A[i]);
      if( A[i]-m > dif ){
         dif = A[i]-m;
         cnt=1;
      }
      else if(A[i]-m == dif ){
         cnt++;
      }
   }
   cout << cnt << endl;
   return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
using ll=long long;

ll gcd(ll a,ll b){
  while(a%b!=0){
    ll tmp=a%b;
    a=b;
    b=tmp;
  }
  return b;
}

ll modpow(ll a,ll n,ll mod){
  ll res=1;
  while(n>0){
    if(n&1){
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

int main(){
  int N;
  cin>>N;
  vector<ll> A(N),B(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i)>>B.at(i);
  }

  map<pair<ll,ll>,ll> m;
  for(int i=0;i<N;i++){
    if(A.at(i)==0&&B.at(i)==0){
      m[make_pair(0,0)]++;
    }else if(A.at(i)==0){
      m[make_pair(0,-1)]++;
    }else if(B.at(i)==0){
      m[make_pair(1,0)]++;
    }else{
      ll x=gcd(abs(A.at(i)),abs(B.at(i)));
      m[make_pair(A.at(i)/x,B.at(i)/x)]++;
    }
  }

  set<pair<ll,ll>> s;
  ll ans=1;
  for(auto p:m){
    if(s.count(p.first)==1){
      continue;
    }
    ll a=p.first.first;
    ll b=p.first.second;
    if(a==0&&b==0){
      continue;
    }

    ll count1=m[make_pair(a,b)]+m[make_pair(-a,-b)];
    ll count2=m[make_pair(b,-a)]+m[make_pair(-b,a)];
    if(count2==0){
      ans*=modpow(2,count1,MOD);
    }else{
      ans*=(modpow(2,count1,MOD)+modpow(2,count2,MOD)-1)%MOD;
    }
    ans%=MOD;
    s.insert(make_pair(a,b));
    s.insert(make_pair(-a,-b));
    s.insert(make_pair(b,-a));
    s.insert(make_pair(-b,a));
  }
  ans+=m[make_pair(0,0)]+MOD-1;
  ans%=MOD;
  cout<<ans<<endl;
}


Measured memory_bytes: 106244
#include <stdio.h>

double judge(double xa,double ya,double xc,double yc,double x,double y){
  return (xa-xc)*(y-ya)+(ya-yc)*(xa-x);
}
int main(){
  double xa,ya,xb,yb,xc,yc,xd,yd;
  double s,s1,s2,s3,s4;
  while (scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&xa,&ya,&xb,&yb,&xc,&yc,&xd,&yd)!=EOF){
    if (judge(xa,ya,xc,yc,xb,yb)*judge(xa,ya,xc,yc,xd,yd)<0)
      if (judge(xb,yb,xd,yd,xa,ya)*judge(xb,yb,xd,yd,xc,yc)<0)
        puts("YES");
      else
        puts("NO");
    else
      puts("NO");
  }
  return 0;
}

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

int main(){
  long long N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;

  long long ABCDE_min = min(A, min(B, min(C, min(D, E))));

  cout << 4 + (N + ABCDE_min - 1) / (ABCDE_min) << endl;
}



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

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

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

	vector<ll> sum_clock(n),sum_counter(n);
	sum_clock[0] = v[0];
	for(int i = 1; i < n; i++){
		sum_clock[i] += sum_clock[i-1] + v[i];
	}
	for(int i = 0; i < n; i++){
		sum_clock[i] -= x[i];
	}

	sum_counter[n-1] = v[n-1];
	for(int i = n-2; i >= 0; i--){
		sum_counter[i] += sum_counter[i+1] + v[i];
	}
	for(int i = 0; i < n; i++){
		sum_counter[i] -= c-x[i];
	}


	vector<ll> max_clock(n),max_counter(n);
	ll res = 0;
	for(int i = 0; i < n; i++){
		max_clock[i] = max(res,sum_clock[i]);
		res = max_clock[i];
	}
	res = 0;
	for(int i = n-1; i >=0 ; i--){
		max_counter[i] = max(res,sum_counter[i]);
		res = max_counter[i];
		//cout << max_counter[i] << endl;
	}

	ll ans = 0;
	for(int i = 0; i < n; i++){
		ans = max(ans,sum_clock[i]);
		ans = max(ans,sum_counter[i]);
	}
	for(int i = 0; i < n; i++){
		ans = max(ans,sum_clock[i] - x[i] + (i!=n-1?max_counter[i+1]:0));
	}
	for(int i = n-1; i >= 0; i--){
		ans = max(ans,sum_counter[i] - (c-x[i]) + (i!=0?max_clock[i-1]:0));
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
using namespace std;
 
int main()
{
	int outp=0;
	int n;
	int k;
	cin >> n >> k;	
	int heights [n] = { };
	for (int i = 0; i < n; i++) {
		cin >> heights[i];
	}
	for (int i = 0; i < n; i++) {
		if (heights[i] >= k) {
			outp++;
		}
	}
	cout << outp << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
 using namespace __gnu_pbds;
 using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0)
#define mod                     1000000007
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
#define fill(a,v)               memset(a, v, sizeof a)
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
typedef  long long                   ll;
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  unordered_map<int, int>    mii;
typedef  vector<ll>                 vll;

const int MAXN = 5e5 + 10;



clock_t time_p=clock();
void timer()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int main()
{
  FIO;
 
  ll n,x,cnt=0,tot=0,tem;
  cin>>n>>x;
  ll a[n];
  forn(i,n)
   cin>>a[i];
  
  rep(i,1,n-1)
  {
    if(a[i]+a[i-1]>x)
    {
        ll temp=a[i]+a[i-1]-x;
        if(a[i]>=temp)
        {
            tot+=temp;
            a[i]-=temp;
        }
        else
        {
            tem=a[i];
            tot+=a[i];
            a[i]=0;
            tot+=(temp-tem);
            a[i-1]-=(temp-tem);
        }
    }
  }

  cout<<tot;
  
 timer();
 return 0;
}

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

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

#define cauto const auto&
#else

#endif

using namespace std;


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

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

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

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

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

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

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

int n,m;
vector<string> v;
vector<string> w;

bool check(int a, int b){
	rep(i,m){
		rep(j,m){
			if(v[a+i][b+j]!=w[i][j]) return false;
		}
	}
	return true;
}

bool mainmain(){
	cin>>n>>m;
	v=vector<string>(n);
	w=vector<string>(m);
	rep(i,n) cin>>v[i];
	rep(i,m) cin>>w[i];
	rep(i,n-m+1){
		rep(j,n-m+1){
			if(check(i,j)){
				return true;
			}
		}
	}
	return false;
}


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

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

char X, Y;

int main() {
  cin >> X >> Y;
  if (X < Y) puts("<");
  else if (X == Y) puts("=");
  else puts(">");
}












Measured memory_bytes: 384