akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(i=0;i<N;++i)
#define print(v) cout<<v<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
#define matoutput(v) do{for(auto outimat:v)output(outimat);}while(0)
void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

int N;
vector<int> Hf,Wf;
vector<unsigned long long> Hv,Wv;
vector<vector<int>> solve(unsigned long long bit){
  int i,j;
  bit=1LL<<bit;
  vector<bool> ch(4,false);
  vector<vector<int>> res(N,vector<int>(N,-1));
  rep(i,N){
    if(Hv[i]&bit){
      if(!Hf[i]){
        ch[0]=true;
        rep(j,N)res[i][j]=1;
      }
    }else{
      if(Hf[i]){
        ch[1]=true;
        rep(j,N)res[i][j]=0;
      }
    }
    if(Wv[i]&bit){
      if(!Wf[i]){
        ch[2]=true;
        rep(j,N)res[j][i]=1;
      }
    }else{
      if(Wf[i]){
        ch[3]=true;
        rep(j,N)res[j][i]=0;
      }
    }
  }
  if((ch[0]&ch[3])|(ch[1]&ch[2])){
    res[0][0]=-1;
    return res;
  }
  if(ch[0]&ch[1]){
    rep(i,N){
      if(res[i][0]!=-1)continue;
      rep(j,N)res[i][j]=Hf[i];
    }
    return res;
  }
  if(ch[2]&ch[3]){
    rep(i,N){
      if(res[0][i]!=-1)continue;
      rep(j,N)res[j][i]=Wf[i];
    }
    return res;
  }
  bool f=false;
  if(ch[0]&ch[2]){
    rep(i,N)rep(j,N)if(res[i][j]==-1){
      f=true;
      res[i][j]=0;
    }
    if(f)return res;
  }
  if(ch[1]&ch[3]){
    rep(i,N)rep(j,N)if(res[i][j]==-1){
      f=true;
      res[i][j]=1;
    }
    if(f)return res;
  }
  int a=0,b=0;
  rep(i,N){
    a+=res[i][0]==-1;
    b+=res[0][i]==-1;
  }
  if(!(a|b)){
    rep(i,N){
      if((!(bit&Hv[i]))==res[0][0])break;
      if((!(bit&Wv[i]))==res[0][0])break;
    }
    if(i<N)res[0][0]=-1;
    return res;
  }
  if(a==1||b==1){
    if(a==1){
      rep(i,N)if(res[i][0]==-1)break;
      if(res[(i+1)%N][0]!=Hf[i]){
        rep(j,N)res[i][j]=Hf[i];
        return res;
      }
      rep(j,N){
        res[i][j]=Wf[j];
        f|=Wf[j]==Hf[i];
      }
      if(!f)res[0][0]=-1;
    }else{
      rep(i,N)if(res[0][i]==-1)break;
      if(res[0][(i+1)%N]!=Wf[i]){
        rep(j,N)res[j][i]=Wf[i];
        return res;
      }
      rep(j,N){
        res[j][i]=Hf[j];
        f|=Hf[j]==Wf[i];
      }
      if(!f)res[0][0]=-1;
    }
  }else{
    f=ch[1]|ch[3];
    rep(i,N)rep(j,N){
      if(res[i][j]==-1){
        res[i][j]=(i==j)^f;
      }
    }
  }
  return res;
}
int main(){
  int i,j;
  unsigned long long bit;
  cin>>N;
  if(N==1){
    unsigned long long x,y;
    cin>>x>>x>>x>>y;
    if(x==y){
      print(x);
    }else{
      print(-1);
    }
    return 0;
  }
  Hf.resize(N);
  Hv.resize(N);
  Wf.resize(N);
  Wv.resize(N);
  for(auto& x:Hf)cin>>x;
  for(auto& x:Wf)cin>>x;
  for(auto& x:Hv)cin>>x;
  for(auto& x:Wv)cin>>x;
  vector<vector<unsigned long long>> ans(N,vector<unsigned long long>(N,0));
  rep(bit,64){
    vector<vector<int>> res=solve(bit);
    if(res[0][0]==-1){
      print(-1);
      return 0;
    }
    rep(i,N)rep(j,N){
      ans[i][j]|=(unsigned long long)res[i][j]<<bit;
    }
  }
  matoutput(ans);
}

Measured memory_bytes: 7564
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int K, N; cin >> N>> K;
	int v;
	for (int i = 0; i < N; i++) {
		cin >> v;
	}

	int p = N - 1;
	int q = K - 1;

	int op = int(p / q);
	(q * op == p) ? op : op++;
	cout << op << endl;
	return 0;
}


Measured memory_bytes: 256
"""Depth First Search."""

n = int(input())

adj = [None]
for i in range(n):
    adj_i = list(map(int, input().split()[2:]))
    adj.append(adj_i)

# searched or not, number of vertex, discovery time and finishing time.
sndf = [None]
for i in range(1, n + 1):
    sndf.append([False, i])

path = []

time = 0

def dfs(u):
    global time
    path.append(u)
    sndf[u][0] = True
    time += 1
    sndf[u].append(time)

    while path:
        u = path[-1]
        if adj[u]:
            v = adj[u].pop(0)
            if not sndf[v][0]:
                sndf[v][0] = True
                time += 1
                sndf[v].append(time)
                path.append(v)
        else:
            path.pop()
            sndf[u][0] = True
            time += 1
            sndf[u].append(time)


for i in range(1, n + 1):
    if not sndf[i][0]:
        dfs(i)

for x in sndf[1:]:
    print(*x[1:])

Measured memory_bytes: 7760
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VI h(n);
    REP(i,0,n) cin >> h[i];
    int ans = 0;
    REP(i,0,n) {
        while (h[i] > 0) {
            REP(j,i,n) {
                if (h[j] > 0) h[j]--;
                else break;
             }
            ++ans;
        }
    }
    cout << ans << endl;
}

int main() {
    solve();
    
    return 0;
}

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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<double, double> pd;
typedef pair<int, int> pi; typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;  typedef pair<ll, pi> plp;
typedef pair<int, pi> pip; typedef tuple<int, int, int> ti;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 1e5 + 100;

int N, M;
int Color[MAX_N];
vector<int> Ed[MAX_N];
int main() {
	cin >> N >> M;
	for(int i=0; i<M; i++) {
		int x, y; scanf("%d%d", &x, &y);
		Ed[x].push_back(y);
		Ed[y].push_back(x);
	}
	queue<int> Q; Q.push(1); Color[1] = 1;
	while(!Q.empty()) {
		int v = Q.front(); Q.pop();
		for(int w : Ed[v]) {
			if(Color[w] != 0) continue;
			Color[w] = 3 - Color[v];
			Q.push(w);
		}
	}
	bool isB = true;
	for(int v=1; v<=N; v++) for(int w : Ed[v]) if(Color[v] + Color[w] != 3) isB = false;
	int cnt[3] = {0, 0, 0};
	for(int i=1; i<=N; i++) cnt[Color[i]]++;

	if(isB) {
		printf("%lld\n", 1ll * cnt[1] * cnt[2] - M);
	}else{
		printf("%lld\n", 1ll * N * (N-1) / 2 - M);
	}
	return 0;
}


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

int main(){
  int64_t a = 2;
  int64_t b = 1;
  int N;
  cin>>N;
  if (N==1){
    cout<<b<<endl;
    exit(0);
  }
  int64_t t;
  for (int i=2;i<N+1;i++){
    t = a+b;
    a = b;
    b = t;
  }
  cout<<b<<endl;
}
      
    

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
static inline void PUT(char c)
{
  static char buf[1<<15],*ptr=buf;
  if(ptr==buf+strlen(buf)||c==0){fwrite(buf,1,ptr-buf,stdout),ptr=buf;}*ptr++=c;
}
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(int a)
{
  if(a<0)PUT('-'),a=-a;
  int d[40],i=0;do{d[i++]=a%10;}while(a/=10);
  while(i--){PUT(d[i]+48);}PUT('\n');
}
static inline int Min(int a,int b){return a<b?a:b;}
const int N=2e5+1,M=(N<<2),oo=(~0u>>2);
int n,m,mn[M],z[M],t[M],g[M],ql,qr,qx;
static inline void pu(int x){z[x]=z[x*2];t[x]=t[x*2+1];mn[x]=Min(mn[x*2],mn[x*2+1]);}
static inline void build(int x,int l,int r){if(l==r){z[x]=l;t[x]=l;return;}int m=(l+r)/2;build(x*2,l,m);build(x*2+1,m+1,r);pu(x);}
static inline void pt(int x,int w,int r){g[x]=w;t[x]=w;z[x]=w;if(w<=m){mn[x]=w-r;}else{mn[x]=oo;}}
static inline void upd(int x,int l,int r)
{
  if(z[x]>qr||t[x]<ql){return;}if(z[x]>=ql&&t[x]<=qr){pt(x,qr+1,r);return;}
  int m=(l+r)/2;if(g[x]){pt(x*2,g[x],m);pt(x*2+1,g[x],r);g[x]=0;}upd(x*2,l,m);upd(x*2+1,m+1,r);pu(x);
}
int main()
{
  n=IN(),m=IN();build(1,1,m);
  for(int i=0;i<n;i++){ql=IN(),qr=IN();upd(1,1,m);if(mn[1]>m){puts(""),puts("-1");}else{OUT(mn[1]+i+1);}}
}

Measured memory_bytes: 9812
N = int(input())
S = input()
ans = 0
for i in range(1000):
    v = str(i).zfill(3)
    idx = 0
    c = 0
    idx_now = 0
    for j in range(3):
        idx = S[idx_now:].find(v[j])
        if idx == -1:
            break
        else:
            idx_now += idx + 1
            c += 1
    if c == 3:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int l = s.size();
string ans = "AC";

if(s[0] != 'A'){
  ans = "WA";
}
int count = 0;

for(int i = 1;i < l;i++){
  if(isupper(s[i])){
    if(i == 1||i==l-1||s[i] != 'C'){
      ans = "WA";
    }
    count++;
  }
}

if(count != 1){
  ans = "WA";
}
cout<< ans <<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>
#include <cstring>

using namespace std;

#define mp make_pair
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define FFOR(i, a, b) for(int (i)=a;(i)>(b);--(i))
#define rrep(i,n) FFOR(i,0,n)
#define vsort(v) sort((v).begin(), (v).end());					//小さい順
#define rvsort(v) sort(v.begin(), v.end(),greater<>());		//大きい順
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define all(c) (c).begin(),(c).end()
#define ll long long
#define lb long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define F first
#define S second
#define pb push_back
#define mod 1000000007LL
#define INF 1234567890123456
typedef pair<int, int> P;
typedef pair<int, P> PP;

const int maxn =1e5 + 10;

//initialization here
//

//
//initialization finish


// your function is here
//

//
// your function finished

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// your code is here
	//

	rep(i,3)rep(j,3)
	{
		char a;cin>>a;
		if(i==j) cout<<a;
	}
	cout<<endl;
	//
	// your code finished


	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main {
static long[][] memo;
static int I,J;
static String h,s;
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
	   h=sc.nextLine();
	   s=sc.nextLine();
	   I=h.length();
	   J=s.length();
	   memo=new long[I][J];
	   for(long []a:memo)
		   Arrays.fill(a,-1);
	   dp(0,0);
	   long max=0; int im=0; int jm=0;
	   for(int i=0;i<I;i++) {
		   for(int j=0;j<J;j++)
			   if(memo[i][j]>=max) {
				   max=memo[i][j];
				   im=i;
				   jm=j;
			   }
	   }
	   if(max==0) {
		   System.out.println(" ");
		   return;
	   }
	   trace(0,0);
	}
	static void trace(int i,int j) {
		if(i==I || j==J)
			return;
		if(h.charAt(i)==s.charAt(j)) {
			System.out.print(s.charAt(j));
			trace(i+1,j+1);
			return;
		}
		if(dp(i+1,j)>dp(i,j+1))
			trace(i+1,j);
		else
			trace(i,j+1);
	}
	static long dp(int i,int j) {
		if(i==I || j==J)
			return 0;
		if(memo[i][j]!=-1)
			return memo[i][j];
		long v=0;
		if(h.charAt(i)==s.charAt(j))
		v=1+dp(i+1,j+1);
		return memo[i][j]=Math.max(v, Math.max(dp(i,j+1),dp(i+1,j)));
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 132104
#include <bits/stdc++.h>
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;

int main(){
	int N;
	cin >> N;
	vector<string> S(N);
	map<string,int> mp;
	map<string,int> mp2;
	rep(i,N){
		cin >> S[i];
		mp[S[i]]++;
	}
	
	int count = 0;
	
	vector<string> T;
	
	//最も多く現れている文字列の出現回数をカウントする。
	rep(i,N){
		count = max(count, mp[S[i]]);
	}
	
	rep(i,N){
		if(mp[S[i]] == count && mp2[S[i]] == 0){
			T.push_back(S[i]);
			mp2[S[i]]++;
		}
	}
	
	sort(T.begin(),T.end());
	
	rep(i,T.size()){
		cout << T[i] << endl;
	}
	
    return 0;
}

Measured memory_bytes: 40816
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        char[] a = sc.next().toCharArray();
        char[] b = sc.next().toCharArray();
        StringBuilder sb = new StringBuilder();
        
        for (int i = 0; i < n; i++) {
            sb.append(a[i]);
            sb.append(b[i]);
        }
        
        System.out.println(sb.toString());
    }
}


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

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

    int r = 0;
    int b = 0;
    for (int i = 0; i < n; i++) {
	    if (s[i] == 'R') {
		    r++;
	    } else {
		    b++;
	    }
    }

     cout << (r > b ? "Yes" : "No" ) << endl;

    return 0;
}


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

int main(){
  string S; cin >> S;
  int n = S.size();
  int ans = 1e9;
  for(int i = 0; i < n-2; i++){
    int a = (S[i] - '0')*100 + (S[i+1] - '0')*10 + (S[i+2]-'0');
    int b = abs(a-753);
    ans = min(ans,b);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int h,a;
  cin >> h >> a;
  cout << (h+a-1)/a << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ri register int
#define fi first
#define se second
using namespace std;
inline int read(){
	#define gc getchar
	int ans=0;
	char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	return ans;
	#undef gc
}
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
inline int add(const int&a,const int&b){return a+b>=mod?a+b-mod:a+b;}
inline int dec(const int&a,const int&b){return a>=b?a-b:a-b+mod;}
inline int mul(const int&a,const int&b){return (ll)a*b%mod;}
inline void Add(int&a,const int&b){a=a+b>=mod?a+b-mod:a+b;}
inline void Dec(int&a,const int&b){a=a>=b?a-b:a-b+mod;}
inline void Mul(int&a,const int&b){a=(ll)a*b%mod;}
inline int ksm(int a,int p){int ret=1;for(;p;p>>=1,a=mul(a,a))if(p&1)Mul(ret,a);return ret;}
inline bool check(int x){
	int ret=0;
	while(x)x/=10,++ret;
	return ret&1;
}
const int N=1e5+5;
char s[N];
int n;
inline void solve(int ql,int qr,int cl,int cr){
	for(ri i=1;i<cl;++i)cout<<0<<' ';
	cout<<(cl+1)/2+cr-(cr+1)/2<<' '<<cl-(cl+1)/2+(cr+1)/2<<' ';
	for(ri i=1;i<cr;++i)cout<<0<<' ';
}
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(ri l=1,r;l<=n;l=r+1){
		r=l;
		while(r<n&&s[r+1]=='R')++r;
		int len=r-l+1;
		while(r<n&&s[r+1]=='L')++r;
		solve(l,r,len,r-l+1-len);
	}
	return 0;
}

Measured memory_bytes: 512
N, M = map(int, input().split())

B = [1]*N
R=[0]*N

R[0]=1

for i in range(M):
    x, y = map(int, input().split())
    x-=1
    y-=1
    if R[x] == 1:
        R[y] = 1
    B[x] -= 1
    B[y] += 1
    if B[x] == 0:
        R[x] = 0

print(sum(R))


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

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

//return x^y mod p
ll power(ll x,ll y, ll p)
{
    ll res = 1;     
    x = x % p; 
 
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
 
        y = y>>1; // y = y/2
        x = (x*x) % p;  
    }
    return res;
}

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n; cin>>n;
    vector<lll> arr(n);
    map<lll, int> cnt;
    FOR(i, 0, n) {
        cin>> arr[i].ff >> arr[i].ss;
        if(arr[i].ff || arr[i].ss) {
            ll g = __gcd(abs(arr[i].ff), abs(arr[i].ss));
            arr[i].ff /= g;
            arr[i].ss /= g;

            if(arr[i].ss < 0) {
                arr[i].ss *= -1;
                arr[i].ff *= -1;
            } else if(arr[i].ss == 0) arr[i].ff = 1; 
        }
        cnt[{arr[i].ff, arr[i].ss}]++;
    }

    // for(auto itr : cnt) {
    //     cout << itr.ff.ff << " " << itr.ff.ss << " " << itr.ss << endl;
    // }
    // cout << endl << endl << endl;

    ll res = 1;
    for(auto itr : cnt) {
        ll a, b; tie(a, b) = itr.ff;
        if(a == 0 && b == 0) continue;
        ll freq = itr.ss;
        ll reva = -b, revb = a;
        if(revb < 0) {
            revb *= -1;
            reva *= -1;
        } else if(revb == 0) reva = 1;

        if(!cnt.count({reva, revb})) {
            res *= power(2, freq, MOD);
            res %= MOD;
            continue;
        }
        if(a > reva) continue;
        ll freq2 = cnt[{reva, revb}];
        ll curr = (power(2LL, freq, MOD) + power(2LL, freq2, MOD) - 1 + MOD)%MOD;
        res *= curr; res %= MOD;
    }
    res = (res - 1 + MOD)%MOD; // choose at least one.
    res = (res + cnt[{0, 0}])%MOD;
    cout << res;
    return 0;
}

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

using namespace std;

typedef long long ll;

ll x, y;

int main()
{
    cin >> x >> y;
    ll a, b, c, d;
    a = b = c = d = INT_MAX;
    if(x <= y)
        a = y - x;
    if(-x <= y)
        b = y - (-x) + 1;
    if(x <= -y)
        c = (-y) - x + 1;
    if(-x <= -y)
        d = (-y) - (-x) + 2;
    cout << min(min(a, b), min(c, d));
    return 0;
}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

ll DIV = 1000000007;

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

ll modinv(ll a, ll mod)
{
  return modpow(a, mod - 2, mod);
}

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

  ll result = 0;
  ll ab = modpow(a, n, DIV);
  ll ba = modpow(b, n, DIV);
  ll apb = modpow(a + b, n, DIV);
  ll mcr = 1;

  FOR(m, n, 2 * n)
  {
    if (m != n)
    {
      ab = ab * b % DIV;
      ba = ba * a % DIV;
      mcr = (mcr * (m - 1)) % DIV;
      mcr = (mcr * modinv(m - n, DIV)) % DIV;
      apb = (apb * (a + b)) % DIV;
    }

    ll tmp = mcr * (ab + ba) % DIV;
    tmp = tmp * m % DIV;
    tmp = tmp * modinv(apb, DIV) % DIV;

    // 更新
    result = (result + tmp) % DIV;
  }
  result = (result * 100LL) % DIV;
  result = result * modinv(100LL - c, DIV) % DIV;

  cout << result << endl;
}


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

#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for ( int i = 0 ; i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

int n, N;
vector<int> even_b, odd_b;

bool check(double x) {
  vector<double> a(2);
  Rep(i, 2) a[i] = (double)even_b[i] / x;
  if ( a[0]*a[1] > (double)odd_b[0] ) return false;  
  else return true;
}

bool check_last(int x) {
  vector<int> a(2);
  Rep(i, 2) {
    if ( even_b[i] % x ) return false;
    a[i] = even_b[i] / x;
  }
  if ( a[0]*a[1] == odd_b[0] ) return true;  
  else return false;
}

signed main() {  
  while ( cin >> n, n ) {
    N = n * (n+1) / 2;
    even_b.clear();
    odd_b.clear();
    
    Rep(i, N) {
      int b;
      cin >> b;
      if ( b % 2 ) odd_b.pb(b);
      else even_b.pb(b);
    }

    sort(All(even_b));
    sort(All(odd_b));
    
    double l = 1.0, r = (1 << 31)-1;
    int cnt = 100;
    while ( cnt-- ) {
      double mid = (r + l) / 2.0;      
      if ( check(mid) ) r = mid;
      else l = mid;
    }

    //cout << r << endl;
    int ans = (double)r-1;
    while ( 1 ) {
      if ( ans % 2 ) ans++;
      if ( check_last(ans) ) break;
    }
        
    cout << ans << endl;
    Rep(i, n) {
      if ( i ) cout << " ";
      cout << even_b[i] / ans;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3228
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>
#include <complex>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};


bool dp[5010][5010];


int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n); rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    // 単調性が成り立つことを示す。
    // k - a[i] <= S < k となるSが存在するとすると、
    // a[j] > a[i] を満たす任意のa[j]について、k - a[j] <= S' < k が成り立つようなS'が存在することが示せる。
    // (Sに a[j]が含まれる場合と、a[j]が含まれない場合に分けると示せた。)

    int left = -1;
    int right = n;
    int mid;
    while (right - left > 1) {
        mid = (left + right) / 2;
        vector<vector<bool>> dp(n+1, vector<bool> (k+1, false));
        dp[0][0] = true;

        rep(i, n) {
            rep(j, k+1) {
                if (i == mid) {
                    dp[i+1][j] = dp[i+1][j] | dp[i][j];
                } else {
                    dp[i+1][j] = dp[i+1][j] | dp[i][j];
                    if (j + a[i] <= k) {
                        dp[i+1][j+a[i]] = dp[i+1][j+a[i]] | dp[i][j];
                    } else {
                        dp[i+1][k] = dp[i+1][k] | dp[i][j];
                    }
                }
            }
        }

        bool flag = 0;
        for (int j = max(0, k - a[mid]); j < k; j++) {
            flag |= dp[n][j];
        }
        if (flag) right = mid;
        else left = mid;
    }

    cout << left + 1 << endl;

    return 0;
}


    

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

int c[12];
int a[12][12];
int n,m;
int x;

int func(int num, int cost, int y_base[12]){
	int ret;
	int ret_p,ret_n;
	int i;	
	int f;
	int y[12] = {0,0,0,0,0,0,0,0,0,0,0,0};



	if(num == n-1){
		ret_n = 100000*20;

		f = 1;
		cost += c[num];
		for(i=0;i<m;i++){
			y[i] = y_base[i] + a[num][i];
			if(y[i] < x){
				f = 0;
			}
		}

		if(f==0){
			ret_p = 100000*20;
		}else{
			ret_p = cost;
		}

	}else{

		ret_n = func(num+1,cost,y_base);

		f = 1;
		cost += c[num];
		for(i=0;i<m;i++){
			y[i] = y_base[i] + a[num][i];
			if(y[i] < x){
				f = 0;
			}
		}

		if(f==0){
			ret_p = func(num+1,cost,y);
		}else{
			ret_p = cost;
		}
	}

	if(ret_p < ret_n){
		ret = ret_p;
	}else{
		ret = ret_n;
	}
		
	return ret;
}


int main(void){

	int i,j;
	int y[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
	int cost = 0;
	int ret;

	scanf("%d %d %d",&n,&m,&x);
	for(i=0;i<n;i++){
		scanf("%d",&c[i]);
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}


	ret = func(0,cost,y);

	if(ret == 100000*20){
		printf("-1\n");
	}else{
		printf("%d\n",ret);
	}


	return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n, s = 0, min, k, ans = 0;
    
    cin >> n;
    vector<int> ve(n);
    for(int i = 0; i < n; i++){
        cin >> ve[i];
        s += ve[i];
    }

    if(s % 10 != 0){
        cout << s << endl;
    }else{
        for(int i = 0; i < n; i++){
            min = i;
            for(int j = i + 1; j < n; j++) if(ve[min] > ve[j]) min = j;
            k = ve[i];
            ve[i] = ve[min];
            ve[min] = k;
        }
        
        for(int i : ve){
            if(i % 10 != 0){
                ans = s - i;
                break;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int gcd(int x, int y) {
    int r = x % y;
    while (r != 0) {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    
    vector<int> front_gcd(N), back_gcd(N);
    front_gcd[0] = A[0];
    REP(i, N) front_gcd[i] = gcd(A[i], front_gcd[i - 1]);
    back_gcd[N - 1] = A[N - 1];
    for (int i = N - 2; i >= 0; --i) back_gcd[i] = gcd(A[i], back_gcd[i + 1]);
    
    int ans = max(back_gcd[1], front_gcd[N - 2]);
    REP(i, N - 1) {
        ans = max(ans, gcd(front_gcd[i - 1], back_gcd[i + 1]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}

#define ll long long
#define pb push_back
#define ld long double
#define mp make_pair
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll maxn=6e5+500;
const ll inf=4e9+800;

ll mod,n;
ll a[maxn];

ll findRast(ll x){
	if(x<0)x=0;
	vector<ll> vec;
	for(ll i=x;i<2*n;i++){
		vec.pb(a[i]);
	}
	vector<ll> ves=vec;
	reverse(ves.begin(),ves.end());
	ll m=vec.size();
	ll z=0;
	for(ll i=0;i<m;i++){
		if(vec[i]+ves[i]<mod)return inf;
		z=max(z,ves[i]+vec[i]);
	}
	return z-mod;
}
ll findLeft(ll x){
	if(x>2*n)x=2*n;
	vector<ll> vec;
	for(ll i=0;i<x;i++){
		vec.pb(a[i]);
	}
	vector<ll> ves=vec;
	reverse(ves.begin(),ves.end());
	ll m=vec.size();

	ll z=0;
	for(ll i=0;i<m;i++){
		z=max(z,ves[i]+vec[i]);
	}
	return z;
}
ll findAns(ll x){
	ll vr=findRast(2*x);
	ll vl=findLeft(2*x);
	return max(vr,vl);
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>mod;
	for(ll i=0;i<2*n;i++){
		cin>>a[i];
	}
	sort(a,a+2*n);
	ll b=-1;
	ll e=n;
	ll ans=inf;
	while(e-b>1){
		ll mid=(e+b)/2;
		ll vr=findRast(2*mid);
		if(vr==inf){
			b=mid;
		}else{
			e=mid;
		}
	}
	for(ll i=e-5;i<e+5;i++){
		ans=min(ans,findAns(e));
	}
	cout<<ans;
}


Measured memory_bytes: 6084
var
	ffs:Array[0..1023]of Longint=(0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1);
	i,j,N,M:Longint;
begin
	read(N,M);
	for i:=1 to(1<<N)-1 do begin
		for j:=1 to(1<<M)-1 do write(ffs[i or j]);
		writeln;
	end;
end.


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m), d(m);

    for (int i = 0; i < m; i++) cin >> x[i];

    if (n >= m) {
        cout << 0 << endl;
        return 0;
    }
    sort(x.begin(), x.end());

    int ans = 0;    
    for (int i = 0; i < m - 1; i++) {
        d[i] = x[i+1] - x[i];
        ans += d[i];
    }

    sort(d.begin(), d.end(), greater<int>());

    for (int i = 0; i < n - 1; i++) {
        ans -= d[i];
    }

    cout << ans << endl;

}

Measured memory_bytes: 3992
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define msg(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define pri(a) cout << a << endl;

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

  ll n,ans=0;
  cin >> n;
  //ll n,k,ans=0;
  //cin >> n >> k;
  string s;
  cin >> s;

  rep(i,s.length()){
    rep(j,n){
      if(s[i]+1=='['){
        s[i] = 'A';
      }
      else{
        s[i]++;
      }
    }
  }




  cout << s << endl;

}

Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
A = list(map(int, input().split()))

ans = 1 << 28

for i in range(-100, 101):
    ans = min(ans, sum(map(lambda x: (i - x) ** 2, A)))

print(ans)

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

int main()
{
  long long n,k;
  cin>>n>>k;
  if(n%k==0)
  {
    cout<<0;
    return 0;
  }
  long long temp=n%k;
  if(abs(temp-k)<temp)
  {
    cout<<abs(temp-k);
  }
  else
  {
    cout<<temp;
  }
}

Measured memory_bytes: 3620
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll x,y;
    cin>>x>>y;
    cout<<x+y/2<<endl;
    
    
    return 0;
}



Measured memory_bytes: 256
local h, w = io.read("*n", "*n", "*l")
local words = {}
for i = 1, h do
  local str = io.read()
  for j = 1, w do
    local sstr = str:sub(j, j)
    if not words[sstr] then words[sstr] = 1 else words[sstr] = words[sstr] + 1 end
  end
end
local a, b = 0, 0
for k, v in pairs(words) do
  if v % 2 == 1 then
    if b == 0 then
      b = v
    else
      b = -1
    end
  elseif v % 4 == 2 then
    a = a + 1
  end
end

if h % 2 == 0 and w % 2 == 0 then
  if a == 0 and b == 0 then
    print("Yes")
  else
    print("No")
  end
elseif h % 2 == 1 and w % 2 == 1 then
  if 0 < b then
    if (b - 1) % 4 == 2 then
      a = a + 1
    end
    local hh, hw = (h - 1) // 2, (w - 1) // 2
    if a <= hh + hw then
      print("Yes")
    else
      print("No")
    end
  else
    print("No")
  end
else
  if b ~= 0 then
    print("No")
  else
    if h % 2 == 1 then h, w = w, h end
    local hh = h // 2
    if a <= hh then
      print("Yes")
    else
      print("No")
    end
  end
end


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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    string S;
    cin >> S;
    int lose_count = 0;
    for (auto&& c : S){
        if (c == 'x') lose_count++;
    }
    if (lose_count <= 7){
        puts("YES");
    }else{
        puts("NO");
    }
}


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

using namespace std;

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

  int n, m, q;
  cin >> n >> m >> q;
  vector<long long> a(n + 2), b(m + 2);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  const long long inf = 1e18;
  a[0] = b[0] = -inf;
  a[n + 1] = b[m + 1] = inf;

  while (q--) {
    long long x;
    cin >> x;
    int la = 0, ra = n + 1;
    int lb = 0, rb = m + 1;
    while (ra - la > 1) {
      int mid = (ra + la) / 2;
      (x > a[mid] ? la : ra) = mid;
    }
    while (rb - lb > 1) {
      int mid = (rb + lb) / 2;
      (x > b[mid] ? lb : rb) = mid;
    }
    long long d1, d2, d3, d4;
    d1 = x - a[la];
    d2 = a[ra] - x;
    d3 = x - b[lb];
    d4 = b[rb] - x;
    cout << min({max(d1, d3), max(d2, d4), 2 * d1 + d4, 2 * d2 + d3, 2 * d3 + d2, 2 * d4 + d1}) << '\n';
  }
  return 0;
}

Measured memory_bytes: 2944
#include<iostream>
using namespace std;
int main()
{
  string s;
  int a;
  cin>>s;
  if(s=="SUN") a=7;
  else if(s=="MON")a=6;
  else if(s=="TUE")a=5;
  else if(s=="WED")a=4;
  else if(s=="THU")a=3;
  else if(s=="FRI")a=2;
  else if(s=="SAT")a=1;
  cout<<a<<endl;
}


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

int main() {
  long long N, K;
  cin >> N >> K;
  
  vector<long long> hp(N);
  long long total = 0;
  
  if (N <= K) cout << total << endl;
  
  else {
  for (int i = 0; i < N; i++)  cin >> hp.at(i);
  sort (hp.begin(),hp.end());
  for (int i = 0; i < N-K; i++)  total += hp.at(i);
  cout << total << endl;
  }
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, i ,x;
    
    scanf("%d", &n);
    
    for(i=1; i<n+1; i++){
        x=i;
        if(x%3 == 0){
            printf(" %d", i);
        }else if(x%10 == 3){
            printf(" %d", i);
        }else{
            while(x != 0){
                x /=10;
                if(x % 10 == 3){
                    printf(" %d", i);
                    break;
                }
            }
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>

using namespace std;

int mountain_n;
int mountain_h[100];
int cansee_num;

inline void CheckCanSee()
{
	for (int count_i = 0; count_i < mountain_n; count_i++)
	{
		bool cansee = true;

		for (int j = 0; j < count_i; j++)
		{
			if (mountain_h[j] > mountain_h[count_i])
			{
				cansee = false;
				break;
			}
		}

		if (cansee == true)
		{
			cansee_num++;
		}
	}
}

int main()
{
	cin >> mountain_n;
	for (int i = 0; i < mountain_n; i++)
		cin >> mountain_h[i];

	CheckCanSee();

	cout << cansee_num;

	return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n;
  cin >> n;
  vector<LL> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  LL ans=0,total=a[0];
  if(a[0]==0){
    ans++;
    total++;
  }
  for(int i=1;i<n;i++){
    if(total>0){
      if(total+a[i]<0){
        total+=a[i];
      }else{
        ans+=total+a[i]+1;
        total=-1;
      }
    }else{
      if(total+a[i]>0){
        total+=a[i];
      }else{
        ans+=1-total-a[i];
        total=1;
      }
    }
  }
  LL ans2=0;
  total=a[0];
  if(a[0]==0){
    ans2++;
    total=-1;
  }else if(a[0]>0){
    ans2+=a[0]+1;
    total=-1;
  }else{
    ans2+=-a[0]+1;
    total=1;
  }
  for(int i=1;i<n;i++){
    if(total>0){
      if(total+a[i]<0){
        total+=a[i];
      }else{
        ans2+=total+a[i]+1;
        total=-1;
      }
    }else{
      if(total+a[i]>0){
        total+=a[i];
      }else{
        ans2+=1-total-a[i];
        total=1;
      }
    }
  }
  cout << min(ans,ans2) << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double debt = 100000;
    debt *= 0.001;
    while(sc.hasNext()) {
      int n = sc.nextInt();
      for (int i = 0; i < n; i++) {
        debt *= 1.05;
        debt  = Math.ceil(debt);
      }
      System.out.println((int)debt*1000);
    }
  }
}

Measured memory_bytes: 12000
#include <cstdio>

int n,tmp,a[200010];
int main(){
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        scanf("%d",&tmp);
        a[tmp]++;
    }
    for(int i=1;i<=n;i++)
        printf("%d\n",a[i]);
    return 0;
}

Measured memory_bytes: 2508
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}



int main(void) {

  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;











}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;
const int mod1=998244353;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	string s;cin >> s;
	char c=s.at(k-1)-'A'+'a';
	s.at(k-1)=c;
	cout << s << endl;
}

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

#define fi first
#define se second
#define pb push_back
#define sz(a) (int)(a).size()
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const ll IINF = INT_MAX;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h, a;
    cin >> h >> a;
    cout << (h + a - 1) / a << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inp(n) for(i=0;i<n;i++) cin>>A[i];
#define inz(A,x) memset(A,x,sizeof(A))
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define T 1000000
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>v;
#define sz(v) v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
			/*brownsands IIITA*/

signed main(){
  		
                boost
         int n;
		cin>>n;
  int A[n+10],dp[n+10];
   inz(A,0);inz(dp,5);
  		for(int i=0;i<n;i++)
          cin>>A[i];
  dp[0]=0;
  		for(int i=0;i<n-1;i++){
          for(int j: {i+1,i+2}){
          
            if(j<n)
              dp[j]=min(dp[j],dp[i]+abs(A[i]-A[j]));
          // cout<<A[i]<<" "<<A[j]<<endl;
          }}
  cout<<dp[n-1];

            
			}
 

				
		
		





Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
 
int main() {
	char t[200000];
	size_t len;
	int b = 0;
	scanf("%s",&t);
	len = strlen(t);
	b = len;
	for (int i = 0; i < b; i++) {
		if (t[i] == '?') t[i] = 'D';
	}
	printf("%s", t);
	return 0;
}


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

int main() {
  string T="abcdefghijklmnopqrstuvwxyz", Ans;
  long long N;
  cin >> N;
  while(N>0){
    N--;
    Ans+=T.at(N%26);
    N/=26;
  }
  reverse(Ans.begin(), Ans.end());
  cout << Ans << endl;
}

Measured memory_bytes: 3552
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	lint sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	rep(i, ty - sy) {
		cout << 'U';
	}
	rep(i, tx - sx) {
		cout << 'R';
	}
	rep(i, ty - sy) {
		cout << 'D';
	}
	rep(i, tx - sx) {
		cout << 'L';
	}
	cout << 'L';
	lint dx = tx - sx;
	lint dy = ty - sy;
	rep(i, dy + 1) {
		cout << 'U';
	}
	rep(i, dx + 1) {
		cout << 'R';
	}
	cout << 'D';
	cout << 'R';
	rep(i, dy + 1) {
		cout << 'D';
	}
	rep(i, dx + 1) {
		cout << 'L';
	}
	cout << 'U';
	cout << endl;
}

Measured memory_bytes: 3552
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >> N >> K;
  long long int H[N];
  for(int i=0;i<N;i++)cin>>H[i];
  sort(H,H+N,greater<long long int>());
  long long int ans=0;
  for(int i=0;i<N;i++){
    if(K>0){
      H[i]=0;
      K--;
    }else {
      ans+=H[i];
    }
  }
  cout << ans;
}


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

using namespace std;
int main(void){
    int n, m;
    cin >> n >> m;
    if (abs(n - m) > 1){
        cout << 0 << endl;
        return 0;
    }
    long long ans = 1;
    for (long long i = 1; i <= n; i++){
        ans = (ans * i) % 1000000007;
    }
    for (long long i = 1; i <= m; i++){
        ans = (ans * i) % 1000000007;
    }
    if (n == m) ans = (ans * 2) % 1000000007;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int k, a, b;cin>>k>>a>>b;
	swap(a, b);
	cout<<(a/k - (b-1)/k ? "OK" : "NG")<<endl;

	return 0;
}





Measured memory_bytes: 3604